pub trait Cacheable: Sized {
type Error: Any;
// Required methods
fn to_cache(&self) -> Result<String, Self::Error>;
fn from_cache(string: &String) -> Result<Self, Self::Error>;
}
Expand description
Trait for items that want to be cacheable allows for special to string method for when they get cached all items already able to be converted to a from a string have their default impl
Required Associated Types§
Required Methods§
fn to_cache(&self) -> Result<String, Self::Error>
fn from_cache(string: &String) -> Result<Self, Self::Error>
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.