pub struct Cache<S> { /* private fields */ }
Expand description

A way to access objects along with pre-configured thread-local caches for packed base objects as well as objects themselves.

By default, no cache will be used.

Implementations

Convert this cache’s handle into one that keeps its store in an arc. This creates an entirely new store, so should be done early to avoid unnecessary work (and mappings).

No op, as we are containing an arc handle already.

Dissolve this instance, discard all caches, and return the inner implementation.

Use this methods directly after creating a new instance to add a constructor for pack caches.

These are used to speed up decoding objects which are located in packs, reducing long delta chains by storing their intermediate results.

Use this methods directly after creating a new instance to add a constructor for object caches.

Only use this kind of cache if the same objects are repeatedly accessed for great speedups, usually during diffing of trees.

Set the pack cache constructor on this instance.

Set the object cache constructor on this instance.

Return true if an object cache is present.

Return true if a pack cache is present.

Remove the current pack cache as well as its constructor from this instance.

Remove the current object cache as well as its constructor from this instance.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

The error returned by try_find()

Returns true if the object exists in the database.

Find an object matching id in the database while placing its raw, undecoded data into buffer. Read more

The error returned by try_find()

Returns true if the object exists in the database.

Find an object matching id in the database while placing its raw, undecoded data into buffer. A pack_cache can be used to speed up subsequent lookups, set it to crate::cache::Never if the workload isn’t suitable for caching. Read more

Like Find::try_find(), but with support for controlling the pack cache. A pack_cache can be used to speed up subsequent lookups, set it to crate::cache::Never if the workload isn’t suitable for caching. Read more

Find the packs location where an object with id can be found in the database, or None if there is no pack holding the object. Read more

Obtain a vector of all offsets, in index order, along with their object id.

Return the find::Entry for location if it is backed by a pack. Read more

Converts to this type from the input type.

The error type used for all trait methods. Read more

As write, but takes an input stream. This is commonly used for writing blobs directly without reading them to memory first. Read more

Write objects using the intrinsic kind of hash into the database, returning id to reference it in subsequent reads. Read more

As write, but takes an object kind along with its encoded bytes.

Auto Trait Implementations

Blanket Implementations

A guard object containing the value and keeping it alive. Read more

The loading method. Read more

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

The equivalent of Access::load.

Like try_find(…), but flattens the Result<Option<_>> into a single Result making a non-existing object an error.

Like find(…), but flattens the Result<Option<_>> into a single Result making a non-existing object an error while returning the desired object type. Read more

Like find(…), but flattens the Result<Option<_>> into a single Result making a non-existing object an error while returning the desired object type. Read more

Like find(…), but flattens the Result<Option<_>> into a single Result making a non-existing object an error while returning the desired object type. Read more

Like find(…), but flattens the Result<Option<_>> into a single Result making a non-existing object an error while returning the desired object type. Read more

Like find(…), but flattens the Result<Option<_>> into a single Result making a non-existing object an error while returning the desired iterator type. Read more

Like find(…), but flattens the Result<Option<_>> into a single Result making a non-existing object an error while returning the desired iterator type. Read more

Like find(…), but flattens the Result<Option<_>> into a single Result making a non-existing object an error while returning the desired iterator type. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.