pub unsafe trait RecordIndex:
Sealed
+ Eq
+ Copy
+ Send
+ Sync
+ Ord
+ Hash {
// Required methods
fn contains_bounds(container: &Bounds<Self>, bounds: &Bounds<Self>) -> bool;
fn in_bounds(&self, bounds: &Bounds<Self>) -> bool;
fn enclose_index(bounds: &mut Bounds<Self>, index: Self);
fn empty_bounds() -> Bounds<Self>;
fn bounds_for_index(index: Self) -> Bounds<Self>;
}
Expand description
A type suitable for use as an index into a collection of records.
This trait is currently sealed in order to make changes more easily, and because there currently is no use case for implementing it outside this crate. If you have a use case for this, please file an issue.
§Safety
Consumers of this trait must be able to rely on the correctness of the provided methods
in unsafe
contexts.
All auxiliary traits required by this trait, such as Eq
, Ord
or Hash
,
must be implemented correctly.
If two indices compare unequal, then they must not access the same record in a collection.
Required Methods§
Sourcefn contains_bounds(container: &Bounds<Self>, bounds: &Bounds<Self>) -> bool
fn contains_bounds(container: &Bounds<Self>, bounds: &Bounds<Self>) -> bool
Determine if a set of bounds contains another set of bounds.
Sourcefn in_bounds(&self, bounds: &Bounds<Self>) -> bool
fn in_bounds(&self, bounds: &Bounds<Self>) -> bool
Determine if this index is contained inside the provided bounds.
Sourcefn enclose_index(bounds: &mut Bounds<Self>, index: Self)
fn enclose_index(bounds: &mut Bounds<Self>, index: Self)
Expand these bounds to include the given index.
Sourcefn empty_bounds() -> Bounds<Self>
fn empty_bounds() -> Bounds<Self>
Returns a set of bounds that are empty (zero extent).
Sourcefn bounds_for_index(index: Self) -> Bounds<Self>
fn bounds_for_index(index: Self) -> Bounds<Self>
Returns a set of bounds that exactly contain only the provided index.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.