Trait Pool

Source
pub trait Pool: Clone {
    type Raw;

    // Required methods
    unsafe fn raw_from_slices(&self, slices: SlicesWrap<'_>) -> Self::Raw;
    fn raw_to_slice<'r>(&self, raw: &'r Self::Raw) -> &'r [u8] ;

    // Provided methods
    unsafe fn raw_from_slice(&self, slice: &[u8]) -> Self::Raw { ... }
    unsafe fn raw_from_vec(&self, vec: Vec<u8>) -> Self::Raw { ... }
    fn raw_empty(&self) -> Self::Raw { ... }
    fn raw_into_vec(&self, raw: Self::Raw) -> Vec<u8>  { ... }
    fn raw_into_boxed_slice(&self, raw: Self::Raw) -> Box<[u8]> { ... }
    fn raw_clone(&self, raw: &Self::Raw) -> Self::Raw { ... }
}

Required Associated Types§

Required Methods§

Source

unsafe fn raw_from_slices(&self, slices: SlicesWrap<'_>) -> Self::Raw

§Safety

The provided slices, when joined together using SlicesWrap::to_boxed_slice, must be valid UTF-8. Strictly speaking individual slices don’t have to be valid UTF-8, as long as the whole is, so this should not be relied on, even though it is quite likely that they will be.

Source

fn raw_to_slice<'r>(&self, raw: &'r Self::Raw) -> &'r [u8]

Provided Methods§

Source

unsafe fn raw_from_slice(&self, slice: &[u8]) -> Self::Raw

note to implementors: The default implementation of this function is usually enough; however this can be overridden for optimisation reasons.

§Safety

The provided slice must be valid UTF-8.

Source

unsafe fn raw_from_vec(&self, vec: Vec<u8>) -> Self::Raw

note to implementors: The default implementation of this function is usually enough; however this can be overridden for optimisation reasons.

§Safety

The provided vec must be valid UTF-8.

Source

fn raw_empty(&self) -> Self::Raw

note to implementors: The default implementation of this function is usually enough; however this can be overridden for optimisation reasons.

Source

fn raw_into_vec(&self, raw: Self::Raw) -> Vec<u8>

note to implementors: The default implementation of this function is usually enough; however this can be overridden for optimisation reasons.

Source

fn raw_into_boxed_slice(&self, raw: Self::Raw) -> Box<[u8]>

note to implementors: The default implementation of this function is usually enough; however this can be overridden for optimisation reasons.

Source

fn raw_clone(&self, raw: &Self::Raw) -> Self::Raw

note to implementors: The default implementation of this function is usually enough; however this can be overridden for optimisation reasons.

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§

Source§

impl Pool for GlobalPool

Source§

type Raw = Arc<SliceHashWrap>