Trait BufFactory

Source
pub trait BufFactory:
    Clone
    + Default
    + Debug {
    type Buf: Clone + Debug + AsRef<[u8]>;

    // Required method
    fn buf_from_slice(buf: &[u8]) -> Self::Buf;
}
Expand description

A trait for providing internal storage buffers for [RangeBuf]. The associated type Buf can be any type that dereferences to a slice, but should be fast to clone, eg. by wrapping it with an Arc.

Required Associated Types§

Source

type Buf: Clone + Debug + AsRef<[u8]>

The type of the generated buffer.

Required Methods§

Source

fn buf_from_slice(buf: &[u8]) -> Self::Buf

Generate a new buffer from a given slice, the buffer must contain the same data as the original slice.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§