pub struct Cas { /* private fields */ }Expand description
On-disk content-addressed cache.
Implementations§
Source§impl Cas
impl Cas
Sourcepub fn put(&self, bytes: &[u8]) -> Result<String>
pub fn put(&self, bytes: &[u8]) -> Result<String>
Compute the SHA-256 of bytes and store. Returns the 64-char hex
key. Re-writing the same key is a no-op.
Sourcepub fn get(&self, hash: &str) -> Result<Option<Vec<u8>>>
pub fn get(&self, hash: &str) -> Result<Option<Vec<u8>>>
Retrieve the bytes for a hex key. Returns Ok(None) if absent.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Cas
impl RefUnwindSafe for Cas
impl Send for Cas
impl Sync for Cas
impl Unpin for Cas
impl UnsafeUnpin for Cas
impl UnwindSafe for Cas
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more