Struct Interval

Source
pub struct Interval<T>(/* private fields */);
Expand description

A contiguous interval of the type T.

Intervals are Normalized when created. For Finite types, open bounds will be converted to the nearest contained closed bound.

Implementations§

Source§

impl<T> Interval<T>
where T: Ord + Clone, RawInterval<T>: Normalize,

Source

pub fn write_fmt_with<F>( &self, f: &mut Formatter<'_>, write_fn: F, ) -> Result<(), Error>
where F: Fn(&T, &mut Formatter<'_>) -> Result<(), Error>,

Writes the Interval to the given Formatter using a specified function to write the interval’s boundary points.

Source

pub fn from_str_with<F, E>( s: &str, read_fn: F, ) -> Result<Self, IntervalParseError<E>>
where F: Fn(&str) -> Result<T, E>,

Parses an Interval from a string using the specified function to parse the interval’s boundary points.

Source§

impl<T> Interval<T>
where T: Ord + Clone, RawInterval<T>: Normalize,

Source

pub fn new(left: Bound<T>, right: Bound<T>) -> Self

Constructs a new Interval from the given Bounds.

§Examples
let interval: Interval<i32> = Interval::new(Include(3), Exclude(7));

Finite types will have their bounds closed:

let interval: Interval<i32> = Interval::new(Exclude(-3), Exclude(7));

assert_eq!(interval, Interval::new(Include(-2), Include(6)));

If the bounds are out of order, and empty Interval will be returned.

let interval: Interval<i32> = Interval::new(Exclude(7), Exclude(-7));

assert_eq!(interval, Interval::empty());
Source

pub fn empty() -> Self

Constructs an empty Interval.

§Example
let interval: Interval<i32> = Interval::empty();
Source

pub fn point(point: T) -> Self

Constructs a new degenerate Interval containing the given point.

§Example
let interval: Interval<i32> = Interval::point(3);
Source

pub fn open(left: T, right: T) -> Self

Constructs a new bounded open Interval from the given points.

§Examples
let interval: Interval<i32> = Interval::open(3, 7);

Finite types will have their bounds closed:

let interval: Interval<i32> = Interval::open(-3, 7);

assert_eq!(interval, Interval::new(Include(-2), Include(6)));

If the bounds are out of order, and empty Interval will be returned.

let interval: Interval<i32> = Interval::open(7, -7);

assert_eq!(interval, Interval::empty());
Source

pub fn left_open(left: T, right: T) -> Self

Constructs a new bounded left-open Interval from the given points.

§Examples
let interval: Interval<i32> = Interval::left_open(3, 7);

Finite types will have their bounds closed:

let interval: Interval<i32> = Interval::left_open(-3, 7);

assert_eq!(interval, Interval::new(Include(-2), Include(7)));

If the bounds are out of order, and empty Interval will be returned.

let interval: Interval<i32> = Interval::left_open(7, -7);

assert_eq!(interval, Interval::empty());

If the bounds are identical, a point Interval will be returned.

let interval: Interval<i32> = Interval::left_open(5, 5);

assert_eq!(interval, Interval::point(5));
Source

pub fn right_open(left: T, right: T) -> Self

Constructs a new bounded right-open Interval from the given points.

§Examples
let interval: Interval<i32> = Interval::right_open(3, 7);

Finite types will have their bounds closed:

let interval: Interval<i32> = Interval::right_open(-3, 7);

assert_eq!(interval, Interval::new(Include(-3), Include(6)));

If the bounds are out of order, and empty Interval will be returned.

let interval: Interval<i32> = Interval::right_open(7, -7);

assert_eq!(interval, Interval::empty());

If the bounds are identical, a point Interval will be returned.

let interval: Interval<i32> = Interval::right_open(5, 5);

assert_eq!(interval, Interval::point(5));
Source

pub fn closed(left: T, right: T) -> Self

Constructs a new bounded closed Interval from the given points.

§Examples
let interval: Interval<i32> = Interval::closed(3, 7);

If the bounds are out of order, and empty Interval will be returned.

let interval: Interval<i32> = Interval::closed(7, -7);

assert_eq!(interval, Interval::empty());

If the bounds are identical, a point Interval will be returned.

let interval: Interval<i32> = Interval::closed(5, 5);

assert_eq!(interval, Interval::point(5));
Source

pub fn left_closed(left: T, right: T) -> Self

Constructs a new bounded left-closed Interval from the given points.

§Examples
let interval: Interval<i32> = Interval::left_closed(3, 7);

Finite types will have their bounds closed:

let interval: Interval<i32> = Interval::left_closed(-3, 7);

assert_eq!(interval, Interval::new(Include(-3), Include(6)));

If the bounds are out of order, and empty Interval will be returned.

let interval: Interval<i32> = Interval::left_closed(7, -7);

assert_eq!(interval, Interval::empty());

If the bounds are identical, a point Interval will be returned.

let interval: Interval<i32> = Interval::left_closed(5, 5);

assert_eq!(interval, Interval::point(5));
Source

pub fn right_closed(left: T, right: T) -> Self

Constructs a new bounded right-closed Interval from the given points.

§Examples
let interval: Interval<i32> = Interval::right_closed(3, 7);

Finite types will have their bounds closed:

let interval: Interval<i32> = Interval::right_closed(-3, 7);

assert_eq!(interval, Interval::new(Include(-2), Include(7)));

If the bounds are out of order, and empty Interval will be returned.

let interval: Interval<i32> = Interval::right_closed(7, -7);

assert_eq!(interval, Interval::empty());

If the bounds are identical, a point Interval will be returned.

let interval: Interval<i32> = Interval::right_closed(5, 5);

assert_eq!(interval, Interval::point(5));
Source

pub fn unbounded_from(point: T) -> Self

Constructs a new right-unbounded Interval from (and including) the given point.

§Examples
let interval: Interval<i32> = Interval::unbounded_from(3);

Finite types will have their bounds closed:

let interval: Interval<i32> = Interval::unbounded_from(7);

assert_eq!(interval, Interval::new(Include(7), Include(i32::MAX)));
Source

pub fn unbounded_to(point: T) -> Self

Constructs a new left-unbounded Interval to (and including) the given point.

§Examples
let interval: Interval<i32> = Interval::unbounded_to(3);

Finite types will have their bounds closed:

let interval: Interval<i32> = Interval::unbounded_to(7);

assert_eq!(interval, Interval::new(Include(i32::MIN), Include(7)));
Source

pub fn unbounded_up_from(point: T) -> Self

Constructs a new right-unbounded Interval from (but excluding) the given point.

§Examples
let interval: Interval<i32> = Interval::unbounded_up_from(3);

Finite types will have their bounds closed:

let interval: Interval<i32> = Interval::unbounded_up_from(7);

assert_eq!(interval, Interval::new(Include(8), Include(i32::MAX)));
Source

pub fn unbounded_up_to(point: T) -> Self

Constructs a new left-unbounded Interval to (but excluding) the given point.

§Examples
let interval: Interval<i32> = Interval::unbounded_up_to(3);

Finite types will have their bounds closed:

let interval: Interval<i32> = Interval::unbounded_up_to(7);

assert_eq!(interval, Interval::new(Include(i32::MIN), Include(6)));
Source

pub fn full() -> Self

Constructs a new unbounded Interval containing all points.

§Examples
let interval: Interval<i32> = Interval::full();

Finite types will have their bounds closed:

let interval: Interval<i32> = Interval::full();

assert_eq!(interval, Interval::new(Include(i32::MIN), Include(i32::MAX)));
Source

pub fn into_non_empty(self) -> Option<Self>

Converts the Interval into an Option, returning None if it is empty.

let interval: Interval<i32> = Interval::closed(0, 4);
assert_eq!(interval.into_non_empty(), Some(Interval::closed(0, 4)));

let interval: Interval<i32> = Interval::empty();
assert_eq!(interval.into_non_empty(), None);
Source

pub fn bounds(&self) -> Option<(Bound<T>, Bound<T>)>

Returns the lower and upper Bounds of the Interval, or None if the Interval is empty.

§Examples
let interval: Interval<i32> = Interval::closed(-3, 5);
assert_eq!(interval.bounds(), Some((Include(-3), Include(5))));

Finite types will have their bounds closed:

let interval: Interval<i32> = Interval::open(-3, 5);
 
assert_eq!(interval.bounds(), Some((Include(-2), Include(4))));
Source

pub fn lower_bound(&self) -> Option<Bound<T>>

Returns the lower Bound of the Interval, or None if the Interval is empty.

§Examples
let interval: Interval<i32> = Interval::closed(-3, 5);
assert_eq!(interval.lower_bound(), Some(Include(-3)));

Finite types will have their bounds closed:

let interval: Interval<i32> = Interval::open(-3, 5);
 
assert_eq!(interval.lower_bound(), Some(Include(-2)));
Source

pub fn upper_bound(&self) -> Option<Bound<T>>

Returns the upper Bound of the Interval, or None if the Interval is empty.

§Examples
let interval: Interval<i32> = Interval::closed(-3, 5);
assert_eq!(interval.upper_bound(), Some(Include(5)));

Finite types will have their bounds closed:

let interval: Interval<i32> = Interval::open(-3, 5);
 
assert_eq!(interval.upper_bound(), Some(Include(4)));
Source

pub fn infimum(&self) -> Option<T>

Returns the greatest lower bound of the Interval, or None if the Interval is empty or unbounded below.

§Examples
let interval: Interval<i32> = Interval::closed(-3, 5);
assert_eq!(interval.infimum(), Some(-3));

Finite types will have their bounds closed:

let interval: Interval<i32> = Interval::open(-3, 5);
 
assert_eq!(interval.infimum(), Some(-2));
Source

pub fn supremum(&self) -> Option<T>

Returns the least upper bound of the Interval, or None if the Interval is empty or unbounded above.

§Examples
let interval: Interval<i32> = Interval::closed(-3, 5);
assert_eq!(interval.supremum(), Some(5));

Finite types will have their bounds closed:

let interval: Interval<i32> = Interval::open(-3, 5);
 
assert_eq!(interval.supremum(), Some(4));
Source

pub fn extrema(&self) -> Option<(T, T)>

Returns the greatest lower bound and least upper bound of the Interval, or None if the Interval is empty or unbounded.

§Examples
let interval: Interval<i32> = Interval::closed(-3, 5);
assert_eq!(interval.extrema(), Some((-3, 5)));

Finite types will have their bounds closed:

let interval: Interval<i32> = Interval::open(-3, 5);
 
assert_eq!(interval.extrema(), Some((-2, 4)));
Source

pub fn size(&self) -> Option<T>
where T: Sub<Output = T>,

Returns the size of the Interval, or None if it is either infinite or empty.

§Example
let interval: Interval<i32> = Interval::closed(-3, 7);
assert_eq!(interval.size(), Some(10));
Source

pub fn is_empty(&self) -> bool

Returns true if the interval contains no points.

§Example
let interval: Interval<i32> = Interval::closed(-3, 5);
assert_eq!(interval.is_empty(), false);

let interval: Interval<i32> = Interval::empty();
assert_eq!(interval.is_empty(), true);
Source

pub fn is_degenerate(&self) -> bool

Returns true if the interval contains a single point.

§Example
let interval: Interval<i32> = Interval::closed(-3, 5);
assert_eq!(interval.is_degenerate(), false);

let interval: Interval<i32> = Interval::point(4);
assert_eq!(interval.is_degenerate(), true);
Source

pub fn is_proper(&self) -> bool

Returns true if the interval contains more than one point.

§Example
let interval: Interval<i32> = Interval::closed(-3, 5);
assert_eq!(interval.is_proper(), true);

let interval: Interval<i32> = Interval::point(4);
assert_eq!(interval.is_proper(), false);

let interval: Interval<i32> = Interval::empty();
assert_eq!(interval.is_proper(), false);
Source

pub fn is_open(&self) -> bool

Returns true if the interval is open.

§Examples
let interval: Interval<i32> = Interval::left_open(-3, 5);
assert_eq!(interval.is_open(), false);

let interval: Interval<i32> = Interval::point(4);
assert_eq!(interval.is_open(), false);

Note that the empty and full intervals are open:

let interval: Interval<i32> = Interval::empty();
assert_eq!(interval.is_open(), true);

let interval: Interval<i32> = Interval::full();
assert_eq!(interval.is_open(), false);
Source

pub fn is_left_open(&self) -> bool

Returns true if the interval is left-open.

§Examples
let interval: Interval<i32> = Interval::left_open(-3, 5);
assert_eq!(interval.is_left_open(), false);

let interval: Interval<i32> = Interval::closed(2, 4);
assert_eq!(interval.is_left_open(), false);

Note that the left-unbounded intervals are considered left-open:

let interval: Interval<i32> = Interval::unbounded_to(4);
assert_eq!(interval.is_left_open(), false);

let interval: Interval<i32> = Interval::full();
assert_eq!(interval.is_left_open(), false);
Source

pub fn is_right_open(&self) -> bool

Returns true if the interval is right-open.

§Examples
let interval: Interval<i32> = Interval::right_open(-3, 5);
assert_eq!(interval.is_right_open(), false);

let interval: Interval<i32> = Interval::closed(2, 4);
assert_eq!(interval.is_right_open(), false);

Note that the right-unbounded intervals are considered right-open:

let interval: Interval<i32> = Interval::unbounded_from(4);
assert_eq!(interval.is_right_open(), false);

let interval: Interval<i32> = Interval::full();
assert_eq!(interval.is_right_open(), false);
Source

pub fn is_half_open(&self) -> bool

Returns true if the interval is half-open.

§Examples
let interval: Interval<i32> = Interval::left_open(-3, 5);
assert_eq!(interval.is_half_open(), false);

let interval: Interval<i32> = Interval::closed(2, 4);
assert_eq!(interval.is_half_open(), false);

Note that the half-unbounded intervals are considered half-open:

let interval: Interval<i32> = Interval::unbounded_to(4);
assert_eq!(interval.is_half_open(), false);

let interval: Interval<i32> = Interval::full();
assert_eq!(interval.is_half_open(), false);
Source

pub fn is_closed(&self) -> bool

Returns true if the interval is closed.

§Examples
let interval: Interval<i32> = Interval::closed(-3, 5);
assert_eq!(interval.is_closed(), true);

let interval: Interval<i32> = Interval::left_open(-2, 4);
assert_eq!(interval.is_closed(), true);

Note that the empty and full intervals are closed:

let interval: Interval<i32> = Interval::empty();
assert_eq!(interval.is_closed(), true);

let interval: Interval<i32> = Interval::full();
assert_eq!(interval.is_closed(), true);
Source

pub fn is_left_closed(&self) -> bool

Returns true if the interval is left-closed.

§Example
let interval: Interval<i32> = Interval::closed(-3, 5);
assert_eq!(interval.is_left_closed(), true);

let interval: Interval<i32> = Interval::left_open(-2, 4);
assert_eq!(interval.is_left_closed(), true);
Source

pub fn is_right_closed(&self) -> bool

Returns true if the interval is right-closed.

§Example
let interval: Interval<i32> = Interval::closed(-3, 5);
assert_eq!(interval.is_right_closed(), true);

let interval: Interval<i32> = Interval::right_open(-2, 4);
assert_eq!(interval.is_right_closed(), true);
Source

pub fn is_half_closed(&self) -> bool

Returns true if the interval is half-closed.

§Example
let interval: Interval<i32> = Interval::unbounded_to(-3);
assert_eq!(interval.is_half_closed(), false);

let interval: Interval<i32> = Interval::open(-2, 4);
assert_eq!(interval.is_half_closed(), false);
Source

pub fn is_bounded(&self) -> bool

Returns true if the the interval is bounded.

§Example
let interval: Interval<i32> = Interval::open(-2, 4);
assert_eq!(interval.is_left_bounded(), true);

let interval: Interval<i32> = Interval::unbounded_to(-3);
assert_eq!(interval.is_left_bounded(), true);
Source

pub fn is_left_bounded(&self) -> bool

Returns true if the the interval is left-bounded.

§Example
let interval: Interval<i32> = Interval::open(-2, 4);
assert_eq!(interval.is_left_bounded(), true);

let interval: Interval<i32> = Interval::unbounded_to(-3);
assert_eq!(interval.is_left_bounded(), true);
Source

pub fn is_right_bounded(&self) -> bool

Returns true if the the interval is right-bounded.

§Example
let interval: Interval<i32> = Interval::open(-2, 4);
assert_eq!(interval.is_right_bounded(), true);

let interval: Interval<i32> = Interval::unbounded_from(-3);
assert_eq!(interval.is_right_bounded(), true);
Source

pub fn is_half_bounded(&self) -> bool

Returns true if the the interval is helf-bounded.

§Example
let interval: Interval<i32> = Interval::unbounded_to(-2);
assert_eq!(interval.is_half_bounded(), false);

let interval: Interval<i32> = Interval::full();
assert_eq!(interval.is_half_bounded(), false);
Source

pub fn contains(&self, point: &T) -> bool

Returns true if the the interval contains the given point.

§Example
let interval: Interval<i32> = Interval::closed(0, 20);
assert_eq!(interval.contains(&2), true);

assert_eq!(interval.contains(&-15), false);
Source

pub fn intersects(&self, other: &Self) -> bool

Returns true if the Interval overlaps the given Interval.

§Example
let a: Interval<i32> = Interval::closed(-3, 5);
let b: Interval<i32> = Interval::closed(4, 15);
assert_eq!(a.intersects(&b), true);

let a: Interval<i32> = Interval::closed(-3, 5);
let b: Interval<i32> = Interval::closed(8, 12);
assert_eq!(a.intersects(&b), false);
Source

pub fn is_adjacent_to(&self, other: &Self) -> bool

Returns true if the Interval shares a bound with the given Interval.

§Example
let a: Interval<i32> = Interval::closed(-3, 5);
let b: Interval<i32> = Interval::closed(5, 15);
assert_eq!(a .is_adjacent_to(&b), true);

let a: Interval<i32> = Interval::closed(-3, 5);
let b: Interval<i32> = Interval::closed(8, 12);
assert_eq!(a .is_adjacent_to(&b), false);
Source

pub fn complement(&self) -> impl Iterator<Item = Self>

Returns Intervals containing all points not contained in the Interval.

§Example
let interval: Interval<i32> = Interval::open(-3, 5);
 
assert_eq!(interval.complement().collect::<Vec<_>>(), 
    [Interval::unbounded_to(-3), Interval::unbounded_from(5)]);
Source

pub fn intersect(&self, other: &Self) -> Self

Returns the largest Interval whose points are all contained entirely within the Interval and the given Interval.

§Example
let a: Interval<i32> = Interval::closed(-3, 7);
let b: Interval<i32> = Interval::closed(4, 13);
assert_eq!(a.intersect(&b), Interval::closed(4, 7));
Source

pub fn union(&self, other: &Self) -> impl Iterator<Item = Self>

Returns the Intervals containing all points in the Interval and the given Interval.

§Example
let a: Interval<i32> = Interval::closed(-3, 7);
let b: Interval<i32> = Interval::closed(4, 13);
assert_eq!(a.union(&b).collect::<Vec<_>>(),
    [Interval::closed(-3, 13)]);
Source

pub fn minus(&self, other: &Self) -> impl Iterator<Item = Self>

Returns the Intervals containing all points in the Interval which are not in the given Interval.

§Example
let a: Interval<i32> = Interval::closed(-3, 7);
let b: Interval<i32> = Interval::closed(4, 13);
assert_eq!(a.minus(&b).collect::<Vec<_>>(),
    [Interval::right_open(-3, 4)]);
Source

pub fn enclose(&self, other: &Self) -> Self

Returns the smallest Interval that contains all of the points contained within the Interval and the given Interval.

§Example
let a: Interval<i32> = Interval::closed(-3, 5);
let b: Interval<i32> = Interval::closed(9, 13);
assert_eq!(a.enclose(&b), Interval::closed(-3, 13));
Source

pub fn closure(&self) -> Self

Returns the smallest closed Interval containing all of the points in this Interval.

§Example
let interval: Interval<i32> = Interval::open(-3, 7);
assert_eq!(interval.closure(), Interval::closed(-2, 6));
Source§

impl<T> Interval<T>
where T: Ord + Clone + Sub<T>, RawInterval<T>: Normalize,

Source

pub fn width(&self) -> Option<T::Output>

Returns the width of the Interval, if it is bounded.

§Example
let interval: Interval<i32> = Interval::open(-3, 7);
assert_eq!(interval.width(), Some(8));
Source§

impl<T> Interval<T>
where T: Ord + Clone + Finite,

Source

pub fn iter(&self) -> Iter<T>

Returns an Iterator over the points in the Interval. Only defined for Finite Intervals.

§Examples
let interval: Interval<i32> = Interval::open(3, 7);
assert_eq!(interval.iter().collect::<Vec<_>>(), [4, 5, 6]);

The Interval can be iterated in both directions.

let interval: Interval<i32> = Interval::open(3, 7);
assert_eq!(interval.iter().rev().collect::<Vec<_>>(), [6, 5, 4]);

Trait Implementations§

Source§

impl<T> Binary for Interval<T>
where T: Binary,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<T: Clone> Clone for Interval<T>

Source§

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

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for Interval<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Default for Interval<T>
where T: Ord + Clone, RawInterval<T>: Normalize,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T> Display for Interval<T>
where T: Display,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Extend<Interval<T>> for Selection<T>
where T: Ord + Clone, RawInterval<T>: Normalize,

Source§

fn extend<I>(&mut self, iter: I)
where I: IntoIterator<Item = Interval<T>>,

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<T> From<Interval<T>> for Selection<T>
where T: Ord + Clone, RawInterval<T>: Normalize,

Source§

fn from(interval: Interval<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Range<T>> for Interval<T>
where T: Ord + Clone, RawInterval<T>: Normalize,

Source§

fn from(r: Range<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<RangeFrom<T>> for Interval<T>
where T: Ord + Clone, RawInterval<T>: Normalize,

Source§

fn from(r: RangeFrom<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<RangeFull> for Interval<T>
where T: Ord + Clone, RawInterval<T>: Normalize,

Source§

fn from(_r: RangeFull) -> Self

Converts to this type from the input type.
Source§

impl<T> From<RangeTo<T>> for Interval<T>
where T: Ord + Clone, RawInterval<T>: Normalize,

Source§

fn from(r: RangeTo<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<RangeToInclusive<T>> for Interval<T>
where T: Ord + Clone, RawInterval<T>: Normalize,

Source§

fn from(r: RangeToInclusive<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<RawInterval<T>> for Interval<T>
where T: Ord + Clone, RawInterval<T>: Normalize,

Source§

fn from(raw_interval: RawInterval<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<T> for Interval<T>
where T: Ord + Clone, RawInterval<T>: Normalize,

Source§

fn from(point: T) -> Self

Converts to this type from the input type.
Source§

impl<T> FromIterator<Interval<T>> for Selection<T>
where T: Ord + Clone, RawInterval<T>: Normalize,

Source§

fn from_iter<I>(iter: I) -> Self
where I: IntoIterator<Item = Interval<T>>,

Creates a value from an iterator. Read more
Source§

impl<T> FromStr for Interval<T>
where T: Ord + FromStr + Finite,

Source§

type Err = IntervalParseError<<T as FromStr>::Err>

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl<T: Hash> Hash for Interval<T>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a, T> IntoIterator for &'a Interval<T>
where T: Ord + Clone + Finite,

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = Iter<T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T> IntoIterator for Interval<T>
where T: Ord + Clone + Finite,

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = Iter<T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T> LowerExp for Interval<T>
where T: LowerExp,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<T> LowerHex for Interval<T>
where T: LowerHex,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<T> Octal for Interval<T>
where T: Octal,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<T: PartialEq> PartialEq for Interval<T>

Source§

fn eq(&self, other: &Interval<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> Pointer for Interval<T>
where T: Pointer,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<T> UpperExp for Interval<T>
where T: UpperExp,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<T> UpperHex for Interval<T>
where T: UpperHex,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<T: Copy> Copy for Interval<T>

Source§

impl<T: Eq> Eq for Interval<T>

Source§

impl<T> StructuralPartialEq for Interval<T>

Auto Trait Implementations§

§

impl<T> Freeze for Interval<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Interval<T>
where T: RefUnwindSafe,

§

impl<T> Send for Interval<T>
where T: Send,

§

impl<T> Sync for Interval<T>
where T: Sync,

§

impl<T> Unpin for Interval<T>
where T: Unpin,

§

impl<T> UnwindSafe for Interval<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.