pub struct InaccessiblePages { /* private fields */ }
Expand description
Represents a page, or range of pages with Inaccessible
accessibility
Implementations§
Source§impl InaccessiblePages
impl InaccessiblePages
Sourcepub fn try_into_mutable(self) -> Result<MutPages, IntoPagesError<Self>>
pub fn try_into_mutable(self) -> Result<MutPages, IntoPagesError<Self>>
Converts this MutPages
into InaccessiblePages
, updating the protection of the underlying pages
§Errors
Will error if protecting the pages fails, error object contains self.
Source§impl InaccessiblePages
impl InaccessiblePages
Sourcepub fn try_into_immutable(self) -> Result<Pages, IntoPagesError<Self>>
pub fn try_into_immutable(self) -> Result<Pages, IntoPagesError<Self>>
Converts this Pages
into InaccessiblePages
, updating the protection of the underlying pages
§Errors
Will error if protecting the pages fails, error object contains self.
Source§impl InaccessiblePages
impl InaccessiblePages
Sourcepub fn split(self, index: usize) -> Result<(Self, Self), Self>
pub fn split(self, index: usize) -> Result<(Self, Self), Self>
Splits this InaccessiblePages
into two consecutive InaccessiblePages
at a given index
§Errors
If the index would result in one half of the split having 0 size, this will return itself back out as an error
Sourcepub fn set_locked(&mut self, locked: bool) -> Result<()>
pub fn set_locked(&mut self, locked: bool) -> Result<()>
Sets whether the pages represented by this InaccessiblePages
is locked into memory or not.
See mlock(2)
§Errors
If the OS returns an error from the mlock
or munlock
syscall, it is returned as an
io::Error
Sourcepub fn join<const C: usize>(
parts: [PagesType; C],
) -> Result<Self, JoinError<[PagesType; C]>>
pub fn join<const C: usize>( parts: [PagesType; C], ) -> Result<Self, JoinError<[PagesType; C]>>
Joins two or more contiguous pages from the same allocation into a single object, updating the protection of the memory region in a single syscall if nessassary.
§Errors
See JoinErrorKind
docs. Will return a JoinError
containing the input PagesType
s and a JoinErrorKind
containing what went wrong.
Sourcepub fn join_vec(
parts: Vec<PagesType>,
) -> Result<Self, JoinError<Vec<PagesType>>>
pub fn join_vec( parts: Vec<PagesType>, ) -> Result<Self, JoinError<Vec<PagesType>>>
Joins two or more contiguous pages from the same allocation into a single object,
updating the protection of the memory region in a single syscall if nessassary.
Accepts a Vec as an input rather than a const size array like Self::join
§Errors
See JoinErrorKind
docs. Will return a JoinError
containing the input PagesType
s and a JoinErrorKind
containing what went wrong.
Sourcepub fn try_into_allocation(self) -> Result<Allocation, Self>
pub fn try_into_allocation(self) -> Result<Allocation, Self>
Converts this InaccessiblePages
into an Allocation
.
If the only reference that still exists to pages inside the allocation is through
self
, then this will succeed.
Other references can be removed by dropping other pages objects or by joining them
together through Self::join
or Self::join_vec
.
§Errors
Will return Self
as an error if other references to the allocation still exist.
Trait Implementations§
Source§impl AnyPages for InaccessiblePages
impl AnyPages for InaccessiblePages
Source§fn start(&self) -> usize
fn start(&self) -> usize
Source§fn end(&self) -> usize
fn end(&self) -> usize
Source§fn accessibility(&self) -> Accessibility
fn accessibility(&self) -> Accessibility
Accessibility
of this pages objectSource§fn allocation(&self) -> &Allocation
fn allocation(&self) -> &Allocation
Allocation
Source§fn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
&dyn Any
object for reference downcastingSource§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
&mut dyn Any
object for reference downcastingSource§fn into_pages_type(self) -> PagesType
fn into_pages_type(self) -> PagesType
PagesType
enum to allow pattern matching and unwrapping on accessibilitySource§fn len_bytes(&self) -> usize
fn len_bytes(&self) -> usize
AnyPages::pages
multiplied by the page size