pub trait Domain: Sized + Copy {
    // Required methods
    fn to_u32(&self) -> u32;
    fn contains(value: u32) -> bool;
    fn from_u32(member: InDomain) -> Self;
    fn is_continuous() -> bool;
    fn ordered_values() -> impl DoubleEndedIterator;
    fn ordered_values_range(
        range: RangeInclusive<Self>,
    ) -> impl DoubleEndedIterator;
    fn count() -> u64;
}Expand description
Defines the domain of IntSet member types.
Members of IntSet must implement this trait. Members of IntSet’s must meet the following
conditions to be used in an IntSet:
- 
Every possible unique value of
Tmust be able map to and from a uniqueu32integer. - 
The mapped
u32values must retain the same ordering as the values inT. - 
ordered_values() must iterate over all values inTin sorted order (ascending). 
from_u32() will only ever be called with u32 values that are part of the domain of T as defined
by an implementation of this trait. So it doesn’t need to correctly handle values
that are outside the domain of T.
Required Methods§
Sourcefn to_u32(&self) -> u32
 
fn to_u32(&self) -> u32
Converts this value of T to a value in u32.
The mapped value must maintain the same ordering as T.
Sourcefn from_u32(member: InDomain) -> Self
 
fn from_u32(member: InDomain) -> Self
Converts a mapped u32 value back to T.
Will only ever be called with values produced by to_u32.
Sourcefn is_continuous() -> bool
 
fn is_continuous() -> bool
Returns true if all u32 values between the mapped u32 min and mapped u32 max value of T are used.
Sourcefn ordered_values() -> impl DoubleEndedIterator
 
fn ordered_values() -> impl DoubleEndedIterator
Returns an iterator which iterates over all values in the domain of T
Values should be converted to u32’s according to the mapping defined in
to_u32/from_u32.
Sourcefn ordered_values_range(range: RangeInclusive<Self>) -> impl DoubleEndedIterator
 
fn ordered_values_range(range: RangeInclusive<Self>) -> impl DoubleEndedIterator
Return an iterator which iterates over all values of T in the given range.
Values should be converted to u32’s according to the mapping defined in
to_u32/from_u32.
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.