Skip to main content

SliceInternable

Trait SliceInternable 

Source
pub trait SliceInternable:
    Sized
    + Send
    + Sync
    + 'static {
    type Header: Eq + Hash + Send + Sync;
    type Item: Copy + Eq + Hash + Send + Sync;

    // Required methods
    fn hash(header: &Self::Header, items: &[Self::Item]) -> u64;
    fn eq(a: &[Self::Item], b: &[Self::Item]) -> bool;
    fn storage() -> &'static InternSliceStorage<Self>;
}

Required Associated Types§

Required Methods§

Source

fn hash(header: &Self::Header, items: &[Self::Item]) -> u64

The hash the value is bucketed by. Implementors whose header already caches a hash of the items can return it directly, which makes interning free of re-hashing.

Source

fn eq(a: &[Self::Item], b: &[Self::Item]) -> bool

Whether two entries are the same value. Only the items take part, so the header must be a pure function of them — otherwise interning would keep whichever header arrived first.

Source

fn storage() -> &'static InternSliceStorage<Self>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§