Struct dumbmath::range::InclusiveRange
[−]
[src]
pub struct InclusiveRange<T: Copy + PartialOrd + Sub> { pub min: T, pub max: T, }
Inclusive range from min to max
Fields
min | |
max |
Methods
impl<T: Copy + PartialOrd + Sub<Output=T>> InclusiveRange<T>
fn new(min: T, max: T) -> InclusiveRange<T>
Create an InclusiveRange from min to max. Asserts that min is less than max.
fn from_sorting(a: T, b: T) -> InclusiveRange<T>
Create an InclusiveRange by sorting the inputs.
fn empty(self) -> bool
True if min == max
, false otherwise.
fn length(self) -> T
Distance between self.min and self.max
fn expand(&mut self, other: InclusiveRange<T>)
Expand self
as needed to include another range.