pub trait FromCoarserIndex<T>{
// Required methods
fn min_from(coarser: T) -> usize;
fn max_from_(coarser: T) -> usize;
// Provided methods
fn max_from(coarser: T, len: usize) -> usize { ... }
fn inclusive_range_from(coarser: T, len: usize) -> RangeInclusive<usize>
where T: Clone { ... }
}Expand description
Maps coarser-grained indices to ranges of finer-grained indices.
Useful for hierarchical index systems where one index type represents a range of another (e.g., mapping hour indices to timestamp ranges).
Required Methods§
Provided Methods§
Sourcefn max_from(coarser: T, len: usize) -> usize
fn max_from(coarser: T, len: usize) -> usize
Returns the maximum fine-grained index, bounded by the data length. Returns 0 if len is 0 (empty data).
Sourcefn inclusive_range_from(coarser: T, len: usize) -> RangeInclusive<usize>where
T: Clone,
fn inclusive_range_from(coarser: T, len: usize) -> RangeInclusive<usize>where
T: Clone,
Returns the inclusive range of fine-grained indices for the coarse index. Returns an empty range (1..=0) if len is 0.
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.