Struct hal_core::mem::page::Handle

source ·
pub struct Handle<'mapper, S: Size, E: PageFlags<S>> { /* private fields */ }
Expand description

A page in the process of being remapped.

This reference allows updating page table flags prior to committing changes.

Implementations§

source§

impl<'mapper, S, E> Handle<'mapper, S, E>
where S: Size, E: PageFlags<S>,

source

pub fn new(page: Page<VAddr, S>, entry: &'mapper mut E) -> Self

source

pub fn virt_page(&self) -> &Page<VAddr, S>

Returns the virtual page this entry is currently mapped to.

source

pub unsafe fn set_writable(self, writable: bool) -> Self

Set whether or not this page is writable.

Safety

Manual control of page flags can be used to violate Rust invariants. Using set_writable to make memory that the Rust compiler expects to be read-only may cause undefined behavior. Making a page which is aliased page table (i.e. it has multiple page table entries pointing to it) may also cause undefined behavior.

source

pub unsafe fn set_executable(self, executable: bool) -> Self

Set whether or not this page is executable.

Safety

Manual control of page flags can be used to violate Rust invariants. Using set_executable to make writable memory executable may cause undefined behavior. Also, this can be used to execute the contents of arbitrary memory, which (of course) is wildly unsafe.

source

pub unsafe fn set_present(self, present: bool) -> Self

Set whether or not this page is present.

Safety

Manual control of page flags can be used to violate Rust invariants.

source

pub fn is_writable(&self) -> bool

source

pub fn is_executable(&self) -> bool

source

pub fn is_present(&self) -> bool

source

pub fn commit(self) -> Page<VAddr, S>

Trait Implementations§

source§

impl<'mapper, S: Debug + Size, E: Debug + PageFlags<S>> Debug for Handle<'mapper, S, E>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'mapper, S, E> RefUnwindSafe for Handle<'mapper, S, E>

§

impl<'mapper, S, E> Send for Handle<'mapper, S, E>
where E: Send, S: Send,

§

impl<'mapper, S, E> Sync for Handle<'mapper, S, E>
where E: Sync, S: Sync,

§

impl<'mapper, S, E> Unpin for Handle<'mapper, S, E>
where S: Unpin,

§

impl<'mapper, S, E> !UnwindSafe for Handle<'mapper, S, E>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Az for T

source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

source§

fn cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> CheckedAs for T

source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> OverflowingAs for T

source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
source§

impl<T> SaturatingAs for T

source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> UnwrappedAs for T

source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> WrappingAs for T

source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.