Skip to main content

StringCache

Trait StringCache 

Source
pub trait StringCache {
    type TAllocator: Allocator;

    // Required method
    fn get_and_cache(
        &mut self,
        value: &str,
    ) -> Result<ImmutableString<Self::TAllocator>, CacheError>;
}
Available on crate feature serde only.
Expand description

Represents a trait for a cache of immutable strings.

Required Associated Types§

Source

type TAllocator: Allocator

Required Methods§

Source

fn get_and_cache( &mut self, value: &str, ) -> Result<ImmutableString<Self::TAllocator>, CacheError>

Gets the immutable string from the cache and caches it if it is not present.

§Errors

For details see CacheError.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<TAllocator: Allocator + TryClone> StringCache for StdStringCache<TAllocator>

Available on crate feature std only.
Source§

type TAllocator = TAllocator