pub struct SingletonStorage<K: Computation> { /* private fields */ }Expand description
Helper to store a simple computation type which has no fields and thus does not require a map to cache each possible value.
Examples include struct SourceFile; or struct Time;
Trait Implementations§
Source§impl<K: Computation> Default for SingletonStorage<K>
impl<K: Computation> Default for SingletonStorage<K>
Source§impl<'de, K> Deserialize<'de> for SingletonStorage<K>
impl<'de, K> Deserialize<'de> for SingletonStorage<K>
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<K> Serialize for SingletonStorage<K>
impl<K> Serialize for SingletonStorage<K>
Source§impl<K> StorageFor<K> for SingletonStorage<K>
impl<K> StorageFor<K> for SingletonStorage<K>
Source§fn get_cell_for_computation(&self, _: &K) -> Option<Cell>
fn get_cell_for_computation(&self, _: &K) -> Option<Cell>
Given a computation key, return the cell associated with it, if it exists.
Source§fn insert_new_cell(&self, cell: Cell, key: K)
fn insert_new_cell(&self, cell: Cell, key: K)
Insert a new Cell with the given computation that has yet to be run
Source§fn try_get_input(&self, _: Cell) -> Option<K>
fn try_get_input(&self, _: Cell) -> Option<K>
Retrieve the input for this computation, returning
None if not found.Source§fn get_output(&self, _: Cell) -> Option<K::Output>
fn get_output(&self, _: Cell) -> Option<K::Output>
Retrieve the output for the given cell, if it exists
Source§fn update_output(&self, _: Cell, new_value: K::Output) -> bool
fn update_output(&self, _: Cell, new_value: K::Output) -> bool
C has been re-run and has returned the output new_value, return true
if new_value has changed from its previous value, and cache the new value
if needed. If C::ASSUME_CHANGED is true, skip the comparison and assume the value changed.fn gc(&mut self, used_cells: &HashSet<Cell>)
Auto Trait Implementations§
impl<K> !Freeze for SingletonStorage<K>
impl<K> RefUnwindSafe for SingletonStorage<K>where
K: RefUnwindSafe + UnwindSafe,
impl<K> Send for SingletonStorage<K>
impl<K> Sync for SingletonStorage<K>
impl<K> Unpin for SingletonStorage<K>
impl<K> UnwindSafe for SingletonStorage<K>where
K: UnwindSafe,
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