Rangeable

Trait Rangeable 

Source
pub trait Rangeable:
    RangeableSealed
    + Sized
    + Copy
    + Ord {
    // Provided method
    fn range_across(
        items: impl IntoIterator<Item = Self>,
    ) -> Option<Range<Self>> { ... }
}
Expand description

Marker for newtypes reduced by [min, max] range. Implemented by OrdinalI32, OrdinalU32, and OrdinalU64.

range_across returns Option<Range<Self>>None for an empty iterator, Some(Range) otherwise. The wrapped Range value carries min ≤ max as a type-system invariant so downstream consumers (the format dispatch, derived metrics, the Aggregated::OrdinalRange boundary) cannot observe a swapped pair. The reduction tracks min and max separately while walking the input, so the constructor invariant is satisfied by construction.

Sealed via sealed::RangeableSealed: a downstream crate cannot write impl Rangeable for u64 because the sealed supertrait is private to this module.

Provided Methods§

Source

fn range_across(items: impl IntoIterator<Item = Self>) -> Option<Range<Self>>

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.

Implementors§