pub trait Store<B, I>{
    // Required methods
    fn put_from<R: Read>(
        &mut self,
        key: &str,
        r: &mut R,
    ) -> Result<usize, Error>;
    fn get_to<W: Write>(&mut self, key: &str, w: &mut W) -> Result<usize, Error>;
    fn prefix(&mut self, prefix: &str) -> I;
    fn delete(&mut self, key: &str) -> Result<(), Error>;
    // Provided methods
    fn put(&mut self, key: &str, data: &[u8]) -> Result<(), Error> { ... }
    fn get(&mut self, key: &str) -> Result<Vec<u8>, Error> { ... }
    fn remove(&mut self, name: &str) -> Result<(), Error> { ... }
}Expand description
A generic Storage system for blobs.
Required Methods§
Sourcefn put_from<R: Read>(&mut self, key: &str, r: &mut R) -> Result<usize, Error>
 
fn put_from<R: Read>(&mut self, key: &str, r: &mut R) -> Result<usize, Error>
Save the content of r into the storage system with the given key.
Sourcefn get_to<W: Write>(&mut self, key: &str, w: &mut W) -> Result<usize, Error>
 
fn get_to<W: Write>(&mut self, key: &str, w: &mut W) -> Result<usize, Error>
Read the contents of the blob with the given key into the given writer.
Provided Methods§
Sourcefn put(&mut self, key: &str, data: &[u8]) -> Result<(), Error>
 
fn put(&mut self, key: &str, data: &[u8]) -> Result<(), Error>
Similar to put_from but uses the give data instead of a reader.
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.