pub trait IncidenceIndex: IncidenceBase {
// Required methods
fn incidence_bound(&self) -> usize;
fn incidence_index(&self, incidence: Self::IncidenceId) -> usize;
}Expand description
Dense incidence-index capability for topology views.
This capability maps visible incidence IDs to compact array indexes usable by algorithms that need per-incidence scratch storage. Views that do not expose incidences do not implement this trait.
incidence_bound is an allocation bound, not necessarily the exact visible
incidence count. Immutable compact layouts usually have incidence_bound() == incidence_count(). Mutable layouts may expose a larger bound.
Implementations must ensure every valid visible incidence maps to an index
less than incidence_bound, distinct visible incidences map to distinct
indexes, and indexes remain stable for the lifetime of the view operation
using them.
§Performance
Methods should be O(1) unless an implementation documents a weaker
contract.
Required Methods§
Sourcefn incidence_bound(&self) -> usize
fn incidence_bound(&self) -> usize
Returns the exclusive upper bound for incidence indexes in this view.
§Performance
Expected O(1) unless the implementation documents otherwise.
Sourcefn incidence_index(&self, incidence: Self::IncidenceId) -> usize
fn incidence_index(&self, incidence: Self::IncidenceId) -> usize
Returns the dense index for incidence in this view.
§Performance
Expected O(1) unless the implementation documents otherwise.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".