Skip to main content

Interner

Trait Interner 

Source
pub trait Interner {
    // Required methods
    fn is_empty(&self) -> bool;
    fn len(&self) -> usize;
    fn len_bytes(&self) -> usize;
    fn capacity_bytes(&self) -> usize;
    fn try_intern(&self, s: &str) -> Option<InternedString>;
}
Expand description

A string interner.

Required Methods§

Source

fn is_empty(&self) -> bool

Returns true if the interner contains no strings.

Source

fn len(&self) -> usize

Returns the number of strings in the interner.

Source

fn len_bytes(&self) -> usize

Returns the total number of bytes in the interner.

Source

fn capacity_bytes(&self) -> usize

Returns the total number of bytes the interner can hold.

Source

fn try_intern(&self, s: &str) -> Option<InternedString>

Attempts to intern the given string.

Returns None if the interner is full or the string can’t fit.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T> Interner for &T
where T: Interner,

Implementors§

Source§

impl Interner for GenericMapInterner

Source§

impl<const SHARD_FACTOR: usize> Interner for FixedSizeInterner<SHARD_FACTOR>