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.

Trait Implementations

Derived Implementations

impl<T: PartialEq + Copy + PartialOrd + Sub> PartialEq for InclusiveRange<T> where T: PartialEq, T: PartialEq

fn eq(&self, __arg_0: &InclusiveRange<T>) -> bool

fn ne(&self, __arg_0: &InclusiveRange<T>) -> bool

impl<T: Debug + Copy + PartialOrd + Sub> Debug for InclusiveRange<T> where T: Debug, T: Debug

fn fmt(&self, __arg_0: &mut Formatter) -> Result

impl<T: Copy + Copy + PartialOrd + Sub> Copy for InclusiveRange<T> where T: Copy, T: Copy

impl<T: Clone + Copy + PartialOrd + Sub> Clone for InclusiveRange<T> where T: Clone, T: Clone

fn clone(&self) -> InclusiveRange<T>

fn clone_from(&mut self, source: &Self)