pub struct PageRangeBox<A: PageRangeAllocator>(/* private fields */);Implementations§
Source§impl<A: PageRangeAllocator> PageRangeBox<A>
impl<A: PageRangeAllocator> PageRangeBox<A>
Methods from Deref<Target = PageRange>§
Sourcepub fn start(self) -> usize
pub fn start(self) -> usize
Returns the start address of this page range.
§Examples
use free_list::PageRange;
let range = PageRange::new(0x1000, 0x5000).unwrap();
assert_eq!(range.start(), 0x1000);Sourcepub fn end(self) -> usize
pub fn end(self) -> usize
Returns the end address of this page range.
§Examples
use free_list::PageRange;
let range = PageRange::new(0x1000, 0x5000).unwrap();
assert_eq!(range.end(), 0x5000);Sourcepub fn len(self) -> NonZero<usize>
pub fn len(self) -> NonZero<usize>
Returns the length of this page range in bytes.
§Examples
use free_list::PageRange;
let range = PageRange::new(0x1000, 0x5000).unwrap();
assert_eq!(range.len().get(), 0x4000);Sourcepub fn overlaps(self, other: PageRange) -> bool
pub fn overlaps(self, other: PageRange) -> bool
Returns true if self overlaps with other.
This property is exclusive with PageRange::touches.
§Examples
use free_list::PageRange;
let a = PageRange::new(0x1000, 0x5000).unwrap();
let b = PageRange::new(0x3000, 0x7000).unwrap();
assert!(a.overlaps(b));Sourcepub fn touches(self, other: PageRange) -> bool
pub fn touches(self, other: PageRange) -> bool
Returns true if self touches other.
This is exclusive with PageRange::overlaps.
§Examples
use free_list::PageRange;
let a = PageRange::new(0x1000, 0x5000).unwrap();
let b = PageRange::new(0x5000, 0x9000).unwrap();
assert!(a.touches(b));Sourcepub fn contains(self, other: PageRange) -> bool
pub fn contains(self, other: PageRange) -> bool
Returns true if self contains other.
§Examples
use free_list::PageRange;
let a = PageRange::new(0x1000, 0x5000).unwrap();
let b = PageRange::new(0x1000, 0x3000).unwrap();
assert!(a.contains(b));Sourcepub fn fit(self, layout: PageLayout) -> Option<PageRange>
pub fn fit(self, layout: PageLayout) -> Option<PageRange>
Returns the first page range that is contained in self and satisfies layout.
§Examples
use free_list::{PageLayout, PageRange};
let range = PageRange::new(0x1000, 0x5000).unwrap();
let layout = PageLayout::from_size_align(0x3000, 0x2000).unwrap();
let expected = PageRange::new(0x2000, 0x5000).unwrap();
assert_eq!(range.fit(layout), Some(expected));Sourcepub fn and(self, rhs: PageRange) -> Option<PageRange>
pub fn and(self, rhs: PageRange) -> Option<PageRange>
Returns the intersection of self and rhs as a new PageRange if non-empty.
§Examples
use free_list::PageRange;
let lhs = PageRange::new(0x1000, 0x3000).unwrap();
let rhs = PageRange::new(0x2000, 0x5000).unwrap();
let expected = PageRange::new(0x2000, 0x3000).unwrap();
assert_eq!(lhs.and(rhs), Some(expected));Trait Implementations§
Source§impl<A: PageRangeAllocator> Deref for PageRangeBox<A>
impl<A: PageRangeAllocator> Deref for PageRangeBox<A>
Source§impl<A: PageRangeAllocator> Drop for PageRangeBox<A>
impl<A: PageRangeAllocator> Drop for PageRangeBox<A>
Auto Trait Implementations§
impl<A> Freeze for PageRangeBox<A>where
PhantomData<A>: Freeze,
impl<A> RefUnwindSafe for PageRangeBox<A>where
PhantomData<A>: RefUnwindSafe,
impl<A> Send for PageRangeBox<A>where
PhantomData<A>: Send,
impl<A> Sync for PageRangeBox<A>where
PhantomData<A>: Sync,
impl<A> Unpin for PageRangeBox<A>where
PhantomData<A>: Unpin,
impl<A> UnsafeUnpin for PageRangeBox<A>where
PhantomData<A>: UnsafeUnpin,
impl<A> UnwindSafe for PageRangeBox<A>where
PhantomData<A>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more