pub struct InMemoryStack<B: PointLike, C: PointLike, V = (), PB = (), PC = ()> {
pub up: HashMap<B, Vec<(C, V)>>,
pub down: HashMap<C, Vec<(B, V)>>,
/* private fields */
}Expand description
In-memory implementation of the Stack trait.
Stores vertical arrows in two hash maps:
upmaps base points to a list of(cap_point, payload).downmaps cap points to a list of(base_point, payload).
Also embeds two InMemorySieves to represent the base and cap topologies themselves.
Fields§
§up: HashMap<B, Vec<(C, V)>>Upward adjacency: base -> cap
down: HashMap<C, Vec<(B, V)>>Downward adjacency: cap -> base
Implementations§
Source§impl<B, C, V, PB, PC> InMemoryStack<B, C, V, PB, PC>
impl<B, C, V, PB, PC> InMemoryStack<B, C, V, PB, PC>
Sourcepub fn reserve_lift(&mut self, base: B, additional: usize)
pub fn reserve_lift(&mut self, base: B, additional: usize)
Hint: preallocate additional upward slots for base.
Sourcepub fn reserve_drop(&mut self, cap: C, additional: usize)
pub fn reserve_drop(&mut self, cap: C, additional: usize)
Hint: preallocate additional downward slots for cap.
Sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Optionally release excess capacity after bulk construction.
Source§impl<B, C, T, PB, PC> InMemoryStack<B, C, Arc<T>, PB, PC>
impl<B, C, T, PB, PC> InMemoryStack<B, C, Arc<T>, PB, PC>
pub fn add_arrow_val( &mut self, base: B, cap: C, payload: T, ) -> Result<(), MeshSieveError>
Source§impl<B, C, V, PB, PC> InMemoryStack<B, C, V, PB, PC>
Provides accessors for base and cap points for testability.
impl<B, C, V, PB, PC> InMemoryStack<B, C, V, PB, PC>
Provides accessors for base and cap points for testability.
pub fn base_points(&self) -> impl Iterator<Item = B> + '_
pub fn cap_points(&self) -> impl Iterator<Item = C> + '_
Source§impl<B, C, V, PB, PC> InMemoryStack<B, C, V, PB, PC>
impl<B, C, V, PB, PC> InMemoryStack<B, C, V, PB, PC>
pub fn invalidate_base_and_cap(&mut self)
Trait Implementations§
Source§impl<B: Clone + PointLike, C: Clone + PointLike, V: Clone, PB: Clone, PC: Clone> Clone for InMemoryStack<B, C, V, PB, PC>
impl<B: Clone + PointLike, C: Clone + PointLike, V: Clone, PB: Clone, PC: Clone> Clone for InMemoryStack<B, C, V, PB, PC>
Source§fn clone(&self) -> InMemoryStack<B, C, V, PB, PC>
fn clone(&self) -> InMemoryStack<B, C, V, PB, PC>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<B: Debug + PointLike, C: Debug + PointLike, V: Debug, PB: Debug, PC: Debug> Debug for InMemoryStack<B, C, V, PB, PC>
impl<B: Debug + PointLike, C: Debug + PointLike, V: Debug, PB: Debug, PC: Debug> Debug for InMemoryStack<B, C, V, PB, PC>
Source§impl<B, C, V, PB, PC> Default for InMemoryStack<B, C, V, PB, PC>
Provides a default implementation for InMemoryStack.
impl<B, C, V, PB, PC> Default for InMemoryStack<B, C, V, PB, PC>
Provides a default implementation for InMemoryStack.
Source§impl<B, C, V, PB, PC> InvalidateCache for InMemoryStack<B, C, V, PB, PC>
impl<B, C, V, PB, PC> InvalidateCache for InMemoryStack<B, C, V, PB, PC>
Source§fn invalidate_cache(&mut self)
fn invalidate_cache(&mut self)
Invalidate all internal caches so future queries recompute correctly.
Source§impl<B, C, V, PB, PC> Stack for InMemoryStack<B, C, V, PB, PC>
impl<B, C, V, PB, PC> Stack for InMemoryStack<B, C, V, PB, PC>
Source§type VerticalPayload = V
type VerticalPayload = V
Vertical arrow payload type.
Source§type BaseSieve = InMemorySieve<B, PB>
type BaseSieve = InMemorySieve<B, PB>
Underlying base Sieve type (horizontal), payload unconstrained.
Source§type CapSieve = InMemorySieve<C, PC>
type CapSieve = InMemorySieve<C, PC>
Underlying cap Sieve type (horizontal), payload unconstrained.
Source§fn lift<'a>(&'a self, p: B) -> Box<dyn Iterator<Item = (C, V)> + 'a>
fn lift<'a>(&'a self, p: B) -> Box<dyn Iterator<Item = (C, V)> + 'a>
Returns an iterator over all upward arrows from base point
p to cap points.
Each item is (cap_point, vertical_payload).Source§fn drop<'a>(&'a self, q: C) -> Box<dyn Iterator<Item = (B, V)> + 'a>
fn drop<'a>(&'a self, q: C) -> Box<dyn Iterator<Item = (B, V)> + 'a>
Returns an iterator over all downward arrows from cap point
q to base points.
Each item is (base_point, vertical_payload).Source§fn add_arrow(&mut self, base: B, cap: C, pay: V) -> Result<(), MeshSieveError>
fn add_arrow(&mut self, base: B, cap: C, pay: V) -> Result<(), MeshSieveError>
Adds a new vertical arrow
base -> cap with associated payload.Source§fn remove_arrow(&mut self, base: B, cap: C) -> Result<Option<V>, MeshSieveError>
fn remove_arrow(&mut self, base: B, cap: C) -> Result<Option<V>, MeshSieveError>
Removes the arrow
base -> cap, returning its payload if present.Source§fn base(&self) -> &Self::BaseSieve
fn base(&self) -> &Self::BaseSieve
Returns a reference to the underlying base Sieve. Read more
Auto Trait Implementations§
impl<B, C, V = (), PB = (), PC = ()> !Freeze for InMemoryStack<B, C, V, PB, PC>
impl<B, C, V, PB, PC> RefUnwindSafe for InMemoryStack<B, C, V, PB, PC>where
B: UnwindSafe + RefUnwindSafe,
C: UnwindSafe + RefUnwindSafe,
V: RefUnwindSafe,
PB: RefUnwindSafe,
PC: RefUnwindSafe,
impl<B, C, V, PB, PC> Send for InMemoryStack<B, C, V, PB, PC>
impl<B, C, V, PB, PC> Sync for InMemoryStack<B, C, V, PB, PC>
impl<B, C, V, PB, PC> Unpin for InMemoryStack<B, C, V, PB, PC>
impl<B, C, V, PB, PC> UnsafeUnpin for InMemoryStack<B, C, V, PB, PC>
impl<B, C, V, PB, PC> UnwindSafe for InMemoryStack<B, C, V, PB, PC>
Blanket Implementations§
Source§impl<T> AccumulatePathExt for T
impl<T> AccumulatePathExt for T
fn accumulate_path<O, I>(path: I) -> Owhere
O: Orientation,
I: IntoIterator<Item = O>,
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