Struct chain_impl_mockchain::multiverse::Multiverse
source · pub struct Multiverse<State> {
states_by_hash: HashMap<HeaderId, GcEntry<State>>,
states_by_chain_length: BTreeMap<ChainLength, HashSet<HeaderId>>,
}
Fields§
§states_by_hash: HashMap<HeaderId, GcEntry<State>>
§states_by_chain_length: BTreeMap<ChainLength, HashSet<HeaderId>>
Implementations§
source§impl<State> Multiverse<State>
impl<State> Multiverse<State>
pub fn new() -> Self
pub fn get(&self, k: &HeaderId) -> Option<Arc<State>>
pub fn get_ref(&self, k: &HeaderId) -> Option<Ref<State>>
sourcepub fn insert(
&mut self,
chain_length: ChainLength,
k: HeaderId,
st: State
) -> Ref<State>
pub fn insert( &mut self, chain_length: ChainLength, k: HeaderId, st: State ) -> Ref<State>
Add a state to the multiverse. Return a Ref object that pins the state in memory.
Trait Implementations§
Auto Trait Implementations§
impl<State> RefUnwindSafe for Multiverse<State>where State: RefUnwindSafe,
impl<State> Send for Multiverse<State>where State: Send + Sync,
impl<State> Sync for Multiverse<State>where State: Send + Sync,
impl<State> Unpin for Multiverse<State>
impl<State> UnwindSafe for Multiverse<State>where State: RefUnwindSafe,
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