pub trait Stack {
type Point: Copy + Eq + Hash;
type CapPt: Copy + Eq + Hash;
type VerticalPayload: Clone;
type BaseSieve: Sieve<Point = Self::Point>;
type CapSieve: Sieve<Point = Self::CapPt>;
// Required methods
fn lift<'a>(
&'a self,
p: Self::Point,
) -> Box<dyn Iterator<Item = (Self::CapPt, Self::VerticalPayload)> + 'a>;
fn drop<'a>(
&'a self,
q: Self::CapPt,
) -> Box<dyn Iterator<Item = (Self::Point, Self::VerticalPayload)> + 'a>;
fn add_arrow(
&mut self,
base: Self::Point,
cap: Self::CapPt,
pay: Self::VerticalPayload,
) -> Result<(), MeshSieveError>;
fn remove_arrow(
&mut self,
base: Self::Point,
cap: Self::CapPt,
) -> Result<Option<Self::VerticalPayload>, MeshSieveError>;
fn base(&self) -> &Self::BaseSieve;
fn cap(&self) -> &Self::CapSieve;
fn base_mut(&mut self) -> Result<&mut Self::BaseSieve, MeshSieveError>;
fn cap_mut(&mut self) -> Result<&mut Self::CapSieve, MeshSieveError>;
}Expand description
A Stack links a base Sieve to a cap Sieve via vertical arrows.
Each vertical arrow carries its own payload (e.g., polarity or permutation),
independent of the horizontal Sieve payloads.
Point: The point type in the base mesh (commonlyPointId).CapPt: The point type in the cap mesh (commonlyPointId).VerticalPayload: Data attached to each vertical arrow (e.g.,Polarity).
Some implementations (such as ComposedStack) do not expose a concrete
base or cap Sieve. Calling Stack::base or Stack::cap on such stacks
will panic. A future refactor may return Option or Result to make these
unsupported operations explicit.
Required Associated Types§
Sourcetype VerticalPayload: Clone
type VerticalPayload: Clone
Vertical arrow payload type.
Required Methods§
Sourcefn lift<'a>(
&'a self,
p: Self::Point,
) -> Box<dyn Iterator<Item = (Self::CapPt, Self::VerticalPayload)> + 'a>
fn lift<'a>( &'a self, p: Self::Point, ) -> Box<dyn Iterator<Item = (Self::CapPt, Self::VerticalPayload)> + 'a>
Returns an iterator over all upward arrows from base point p to cap points.
Each item is (cap_point, vertical_payload).
Sourcefn drop<'a>(
&'a self,
q: Self::CapPt,
) -> Box<dyn Iterator<Item = (Self::Point, Self::VerticalPayload)> + 'a>
fn drop<'a>( &'a self, q: Self::CapPt, ) -> Box<dyn Iterator<Item = (Self::Point, Self::VerticalPayload)> + 'a>
Returns an iterator over all downward arrows from cap point q to base points.
Each item is (base_point, vertical_payload).
Sourcefn add_arrow(
&mut self,
base: Self::Point,
cap: Self::CapPt,
pay: Self::VerticalPayload,
) -> Result<(), MeshSieveError>
fn add_arrow( &mut self, base: Self::Point, cap: Self::CapPt, pay: Self::VerticalPayload, ) -> Result<(), MeshSieveError>
Adds a new vertical arrow base -> cap with associated payload.
Sourcefn remove_arrow(
&mut self,
base: Self::Point,
cap: Self::CapPt,
) -> Result<Option<Self::VerticalPayload>, MeshSieveError>
fn remove_arrow( &mut self, base: Self::Point, cap: Self::CapPt, ) -> Result<Option<Self::VerticalPayload>, MeshSieveError>
Removes the arrow base -> cap, returning its payload if present.
Sourcefn base(&self) -> &Self::BaseSieve
fn base(&self) -> &Self::BaseSieve
Returns a reference to the underlying base Sieve.
§Panics
Implementations may panic if the base Sieve is not exposed (e.g., ComposedStack).
Sourcefn cap(&self) -> &Self::CapSieve
fn cap(&self) -> &Self::CapSieve
Returns a reference to the underlying cap Sieve.
§Panics
Implementations may panic if the cap Sieve is not exposed (e.g., ComposedStack).
Sourcefn base_mut(&mut self) -> Result<&mut Self::BaseSieve, MeshSieveError>
fn base_mut(&mut self) -> Result<&mut Self::BaseSieve, MeshSieveError>
Returns a mutable reference to the underlying base Sieve.
Sourcefn cap_mut(&mut self) -> Result<&mut Self::CapSieve, MeshSieveError>
fn cap_mut(&mut self) -> Result<&mut Self::CapSieve, MeshSieveError>
Returns a mutable reference to the underlying cap Sieve.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".