pub struct DbHandle<'db, S> { /* private fields */ }Expand description
A handle to the database during some operation.
This wraps calls to the Db so that any get calls
will be automatically registered as dependencies of
the current operation.
Implementations§
Source§impl<S: Storage> DbHandle<'_, S>
impl<S: Storage> DbHandle<'_, S>
Sourcepub fn get<C: Computation>(&self, compute: C) -> C::Outputwhere
S: StorageFor<C>,
pub fn get<C: Computation>(&self, compute: C) -> C::Outputwhere
S: StorageFor<C>,
Locking behavior: This function locks the cell corresponding to the given computation. This can cause a deadlock if the computation recursively depends on itself.
Sourcepub fn accumulate<Item>(&self, item: Item)where
S: Accumulate<Item>,
pub fn accumulate<Item>(&self, item: Item)where
S: Accumulate<Item>,
Accumulate an item in the current computation. This item can be retrieved along
with all other accumulated items in this computation and its dependencies via
a call to get_accumulated.
This is most often used for operations like pushing diagnostics or logs.
Sourcepub fn get_accumulated<Item, C>(&self, compute: C) -> Vec<Item>where
C: Computation,
Item: 'static,
S: StorageFor<Accumulated<Item>> + StorageFor<C> + Accumulate<Item>,
pub fn get_accumulated<Item, C>(&self, compute: C) -> Vec<Item>where
C: Computation,
Item: 'static,
S: StorageFor<Accumulated<Item>> + StorageFor<C> + Accumulate<Item>,
Retrieve an accumulated value in a container of the user’s choice. This will return all the accumulated items after the given computation.
This is most often used for operations like retrieving diagnostics or logs.