Trait Cacheable

Source
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§

Source

fn to_cache(&self) -> Result<String, Self::Error>

Source

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.

Implementors§

Source§

impl<T: FromStr + ToString + Sized> Cacheable for T
where T::Err: Any,

Source§

type Error = <T as FromStr>::Err