Struct vm_allocator::RangeInclusive
source · [−]pub struct RangeInclusive { /* private fields */ }
Expand description
A closed interval range [start, end]. The range describes a memory slot which is assigned by the VMM to a device.
Example
use vm_allocator::RangeInclusive;
let r = RangeInclusive::new(0x0, 0x100).unwrap();
assert_eq!(r.len(), 0x101);
assert_eq!(r.start(), 0x0);
assert_eq!(r.end(), 0x100);
// Check if a region contains another region.
let other = RangeInclusive::new(0x50, 0x80).unwrap();
assert!(r.contains(&other));
// Check if a region overlaps with another one.
let other = RangeInclusive::new(0x99, 0x150).unwrap();
assert!(r.overlaps(&other));
Implementations
sourceimpl RangeInclusive
impl RangeInclusive
sourcepub fn overlaps(&self, other: &RangeInclusive) -> bool
pub fn overlaps(&self, other: &RangeInclusive) -> bool
Returns true if the regions overlap.
sourcepub fn contains(&self, other: &RangeInclusive) -> bool
pub fn contains(&self, other: &RangeInclusive) -> bool
Returns true if the current range contains the range passed as a parameter.
Trait Implementations
sourceimpl Clone for RangeInclusive
impl Clone for RangeInclusive
sourcefn clone(&self) -> RangeInclusive
fn clone(&self) -> RangeInclusive
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for RangeInclusive
impl Debug for RangeInclusive
sourceimpl Hash for RangeInclusive
impl Hash for RangeInclusive
sourceimpl Ord for RangeInclusive
impl Ord for RangeInclusive
sourceimpl PartialEq<RangeInclusive> for RangeInclusive
impl PartialEq<RangeInclusive> for RangeInclusive
sourcefn eq(&self, other: &RangeInclusive) -> bool
fn eq(&self, other: &RangeInclusive) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &RangeInclusive) -> bool
fn ne(&self, other: &RangeInclusive) -> bool
This method tests for !=
.
sourceimpl PartialOrd<RangeInclusive> for RangeInclusive
impl PartialOrd<RangeInclusive> for RangeInclusive
sourcefn partial_cmp(&self, other: &RangeInclusive) -> Option<Ordering>
fn partial_cmp(&self, other: &RangeInclusive) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for RangeInclusive
impl Eq for RangeInclusive
impl StructuralEq for RangeInclusive
impl StructuralPartialEq for RangeInclusive
Auto Trait Implementations
impl RefUnwindSafe for RangeInclusive
impl Send for RangeInclusive
impl Sync for RangeInclusive
impl Unpin for RangeInclusive
impl UnwindSafe for RangeInclusive
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more