Struct HashMapBlobStore

Source
pub struct HashMapBlobStore { /* private fields */ }
Expand description

A blob store that is backed by a hash map with a reference counted value. Used for tests when you need an actual blob store.

Trait Implementations§

Source§

impl BlobStore for HashMapBlobStore

Source§

fn clone_blob(&mut self, hash: &BlobHash) -> Result<(), NoSuchBlobError>

Mark the hash as used. Read more
Source§

fn insert_blob(&mut self, bytes: &[u8]) -> BlobHash

Insert bytes into the blob store. Read more
Source§

fn insert_with_uses(&mut self, hash: &BlobHash, uses: usize, bytes: Box<[u8]>)

Insert hash referring to bytes and mark its refcount as uses. Read more
Source§

fn retrieve_blob(&self, hash: &BlobHash) -> Result<&[u8], NoSuchBlobError>

Returns the bytes stored at the content address hash.
Source§

fn free_blob(&mut self, hash: &BlobHash) -> Result<(), NoSuchBlobError>

Marks the hash as unused. Read more
Source§

fn iter_blobs(&self) -> BlobsIter<'_>

Iterate over all blobs present in the blob store. Read more
Source§

fn bytes_used_by_blobs(&self) -> u64

Returns the amount of memory in bytes used by blobs in this BlobStore. Read more
Source§

fn num_blobs(&self) -> u64

Returns the number of blobs, or more precisely, blob-usages, recorded in this BlobStore. Read more
Source§

impl Debug for HashMapBlobStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for HashMapBlobStore

Source§

fn default() -> HashMapBlobStore

Returns the “default value” for a type. Read more
Source§

impl MemoryUsage for HashMapBlobStore

Source§

fn heap_usage(&self) -> usize

The heap memory usage of this type. The default implementation returns 0.
Source§

impl PartialEq for HashMapBlobStore

Source§

fn eq(&self, other: &HashMapBlobStore) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for HashMapBlobStore

Source§

impl StructuralPartialEq for HashMapBlobStore

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.