Skip to main content

InMemoryStack

Struct InMemoryStack 

Source
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:

  • up maps base points to a list of (cap_point, payload).
  • down maps 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>
where B: PointLike, C: PointLike,

Source

pub fn new() -> Self

Creates an empty InMemoryStack with no arrows.

Source

pub fn reserve_lift(&mut self, base: B, additional: usize)

Hint: preallocate additional upward slots for base.

Source

pub fn reserve_drop(&mut self, cap: C, additional: usize)

Hint: preallocate additional downward slots for cap.

Source

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>

Source

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>
where B: PointLike, C: PointLike, V: PayloadLike,

Provides accessors for base and cap points for testability.

Source

pub fn base_points(&self) -> impl Iterator<Item = B> + '_

Source

pub fn cap_points(&self) -> impl Iterator<Item = C> + '_

Source§

impl<B, C, V, PB, PC> InMemoryStack<B, C, V, PB, PC>
where B: PointLike, C: PointLike, PB: PayloadLike, PC: PayloadLike,

Trait Implementations§

Source§

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>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<B: Debug + PointLike, C: Debug + PointLike, V: Debug, PB: Debug, PC: Debug> Debug for InMemoryStack<B, C, V, PB, PC>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<B, C, V, PB, PC> Default for InMemoryStack<B, C, V, PB, PC>
where B: PointLike, C: PointLike, V: PayloadLike,

Provides a default implementation for InMemoryStack.

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<B, C, V, PB, PC> InvalidateCache for InMemoryStack<B, C, V, PB, PC>
where B: PointLike, C: PointLike, V: PayloadLike,

Source§

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>

Source§

type Point = B

Base mesh point identifier.
Source§

type CapPt = C

Cap mesh point identifier.
Source§

type VerticalPayload = V

Vertical arrow payload type.
Source§

type BaseSieve = InMemorySieve<B, PB>

Underlying base Sieve type (horizontal), payload unconstrained.
Source§

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>

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>

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>

Adds a new vertical arrow base -> cap with associated payload.
Source§

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

Returns a reference to the underlying base Sieve. Read more
Source§

fn cap(&self) -> &Self::CapSieve

Returns a reference to the underlying cap Sieve. Read more
Source§

fn base_mut(&mut self) -> Result<&mut Self::BaseSieve, MeshSieveError>

Returns a mutable reference to the underlying base Sieve.
Source§

fn cap_mut(&mut self) -> Result<&mut Self::CapSieve, MeshSieveError>

Returns a mutable reference to the underlying cap Sieve.

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>

§

impl<B, C, V, PB, PC> Send for InMemoryStack<B, C, V, PB, PC>
where B: Send, C: Send, V: Send, PB: Send, PC: Send,

§

impl<B, C, V, PB, PC> Sync for InMemoryStack<B, C, V, PB, PC>
where B: Sync + Send, C: Sync + Send, V: Sync, PB: Sync, PC: Sync,

§

impl<B, C, V, PB, PC> Unpin for InMemoryStack<B, C, V, PB, PC>
where B: Unpin, C: Unpin, V: Unpin, PB: Unpin, PC: Unpin,

§

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

Source§

fn accumulate_path<O, I>(path: I) -> O
where O: Orientation, I: IntoIterator<Item = O>,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.