Trait Key

Source
pub trait Key
where Self: Clone + Debug + Eq + Hash,
{ // Required methods fn new() -> Self; fn as_filename(&self) -> String; }
Expand description

A datatype that can be used as the access key for cached items.

Note that this datatype when converted into a path, should not contain values that can be misinterpreted by the OS (e.g. path separators). I recommend UUIDv4 for most use cases.

Required Methods§

Source

fn new() -> Self

Generate a new, unique key.

Source

fn as_filename(&self) -> String

Convert this key to a filename used for flushing to disk.

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.

Implementations on Foreign Types§

Source§

impl Key for Uuid

Source§

fn new() -> Self

Source§

fn as_filename(&self) -> String

Implementors§