Skip to main content

UnsizedCacheKey

Trait UnsizedCacheKey 

Source
pub trait UnsizedCacheKey {
    type ValueType: 'static + ?Sized;

    // Required methods
    fn key(&self) -> Cow<'_, str>;
    fn type_name() -> &'static str;

    // Provided methods
    fn stable_type_id() -> &'static str { ... }
    fn schema() -> CacheKeySchema { ... }
    fn write_key(&self, builder: &mut KeyBuilder) { ... }
}
Expand description

Like CacheKey but for unsized value types (e.g. dyn Trait).

The cache wraps values in an extra Arc layer internally; callers pass and receive Arc<T> where T: ?Sized.

Unsized cache entries are always in-memory only (no serialization codec). For serializable entries, use a sized CacheKey instead.

Required Associated Types§

Source

type ValueType: 'static + ?Sized

Required Methods§

Source

fn key(&self) -> Cow<'_, str>

Source

fn type_name() -> &'static str

Short, stable string identifying this value type. See CacheKey::type_name for requirements.

Provided Methods§

Source

fn stable_type_id() -> &'static str

Stable identity included in the physical key.

Source

fn schema() -> CacheKeySchema

Versioned schema for the logical key fields.

Source

fn write_key(&self, builder: &mut KeyBuilder)

Stream the logical key fields into the canonical key builder.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§