pub trait RelationIndex: TopologyBase {
// Required methods
fn relation_bound(&self) -> usize;
fn relation_index(&self, relation: Self::RelationId) -> usize;
}Expand description
Dense relation-index capability for topology views.
This capability maps visible relation IDs to compact array indexes usable by algorithms that need per-relation scratch storage. The index is a property of the view, not the ID type itself.
relation_bound is an allocation bound, not necessarily the exact visible
relation count. Immutable compact layouts usually have relation_bound() == relation_count(). Mutable layouts may expose a larger bound.
Implementations must ensure every valid visible relation maps to an index
less than relation_bound, distinct visible relations 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 relation_bound(&self) -> usize
fn relation_bound(&self) -> usize
Returns the exclusive upper bound for relation indexes in this view.
§Performance
Expected O(1) unless the implementation documents otherwise.
Sourcefn relation_index(&self, relation: Self::RelationId) -> usize
fn relation_index(&self, relation: Self::RelationId) -> usize
Returns the dense index for relation 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".