Struct range_map::Range
[−]
[src]
pub struct Range<T> {
pub start: T,
pub end: T,
}A range of elements, including the endpoints.
Fields
start | |
end |
Methods
impl<T: PrimInt> Range<T>[src]
fn new(start: T, end: T) -> Range<T>
Creates a new range with the given start and endpoints (inclusive).
Panics
- if
startis strictly larger thanend
fn full() -> Range<T>
Creates a new range containing everything.
fn single(x: T) -> Range<T>
Creates a new range containing a single thing.
fn contains(&self, x: T) -> bool
Tests whether a given element belongs to this range.
fn intersects(&self, other: &Self) -> bool
Checks whether the intersections overlap.
fn intersection(&self, other: &Self) -> Option<Self>
Computes the intersection between two ranges. Returns none if the intersection is empty.
fn cover(&self, other: &Self) -> Self
Returns the smallest range that covers self and other.
Trait Implementations
impl<T: Debug> Debug for Range<T>[src]
impl<T: PrimInt> PartialEq<T> for Range<T>[src]
fn eq(&self, x: &T) -> bool
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Rhs) -> bool1.0.0
This method tests for !=.
impl<T: PrimInt> PartialOrd<T> for Range<T>[src]
fn partial_cmp(&self, x: &T) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool1.0.0
This method tests less than (for self and other) and is used by the < operator. Read more
fn le(&self, other: &Rhs) -> bool1.0.0
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
fn gt(&self, other: &Rhs) -> bool1.0.0
This method tests greater than (for self and other) and is used by the > operator. Read more
fn ge(&self, other: &Rhs) -> bool1.0.0
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Derived Implementations
impl<T: Ord> Ord for Range<T>[src]
fn cmp(&self, __arg_0: &Range<T>) -> Ordering
This method returns an Ordering between self and other. Read more
impl<T: Eq> Eq for Range<T>[src]
impl<T: PartialOrd> PartialOrd for Range<T>[src]
fn partial_cmp(&self, __arg_0: &Range<T>) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
fn lt(&self, __arg_0: &Range<T>) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
fn le(&self, __arg_0: &Range<T>) -> bool
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
fn gt(&self, __arg_0: &Range<T>) -> bool
This method tests greater than (for self and other) and is used by the > operator. Read more
fn ge(&self, __arg_0: &Range<T>) -> bool
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
impl<T: PartialEq> PartialEq for Range<T>[src]
fn eq(&self, __arg_0: &Range<T>) -> bool
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &Range<T>) -> bool
This method tests for !=.
impl<T: Hash> Hash for Range<T>[src]
fn hash<__HT: Hasher>(&self, __arg_0: &mut __HT)
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher1.3.0
Feeds a slice of this type into the state provided.
impl<T: Clone> Clone for Range<T>[src]
fn clone(&self) -> Range<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0
Performs copy-assignment from source. Read more