pub trait Cacheable: Debug {
// Required methods
fn to_bytes(&self) -> Vec<u8>;
fn from_bytes(bytes: &[u8]) -> Result<Self>
where Self: Sized;
// Provided methods
fn to_hex(&self) -> String { ... }
fn from_hex(hex: &str) -> Result<Self>
where Self: Sized { ... }
}
Expand description
used to convert Cacheable
to bytes and vice versa.