Struct memrange::Range
[−]
[src]
pub struct Range { pub min: u64, pub max: u64, }
Fields
min: u64
max: u64
Methods
impl Range
[src]
fn new(min: u64, max: u64) -> Range
fn intersect(&self, other: &Range) -> bool
fn adjacent(&self, other: &Range) -> bool
fn get_intersection(&self, other: &Range) -> Range
fn get_union(&self, other: &Range) -> Range
fn get_difference(&self, other: &Range) -> (Option<Range>, Option<Range>)
fn len(&self) -> u64
fn get_extended(&self) -> Range
fn each_slice(&self, size: u64) -> Box<Iterator<Item = Range>>
use memrange::{range, Range}; assert_eq!(range(0,5).each_slice(2).collect::<Vec<Range>>(), vec![range(0,1), range(2,3), range(4,5)])
fn intersection_cmp(&self, b: &Range) -> Ordering
use memrange::{range, Range}; use std::cmp::Ordering; assert_eq!(range( 0,5).intersection_cmp(&range(6,100)), Ordering::Less); assert_eq!(range( 0,5).intersection_cmp(&range(5,100)), Ordering::Equal); assert_eq!(range(5,100).intersection_cmp(&range(1,2)), Ordering::Greater);
returns Equal if self and b are intersecting, the usual comparision otherwise
Trait Implementations
impl Debug for Range
[src]
impl Copy for Range
[src]
impl Clone for Range
[src]
fn clone(&self) -> Range
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
impl PartialEq for Range
[src]
fn eq(&self, __arg_0: &Range) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Range) -> bool
This method tests for !=
.
impl Eq for Range
[src]
impl PartialOrd for Range
[src]
fn partial_cmp(&self, __arg_0: &Range) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &Range) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &Range) -> 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) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &Range) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Hash for Range
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Encodable for Range
[src]
fn encode<__S: Encoder>(&self, __arg_0: &mut __S) -> Result<(), __S::Error>
Serialize a value using an Encoder
.
impl Decodable for Range
[src]
fn decode<__D: Decoder>(__arg_0: &mut __D) -> Result<Range, __D::Error>
Deserialize a value using a Decoder
.