Skip to main content

Mapping

Struct Mapping 

Source
pub struct Mapping<R: Mappable, A: Ty> {
    pub(super) raw: R,
    pub(super) address_space: ManuallyDrop<A>,
    pub(super) backing: ManuallyDrop<Backing>,
    pub(super) caching: Caching,
    pub(super) virtual_start: RawPage,
    pub(super) protection: Protection,
}
Available on crate feature full only.
Expand description

The raw type underlying all memory mappings.

This will allocate any required memory when created, and register any lazily mapped memory as such. It will also manage the page tables to correctly unmap the memory when dropped.

Fields§

§raw: R§address_space: ManuallyDrop<A>

The address space mapped into

§backing: ManuallyDrop<Backing>§caching: Caching§virtual_start: RawPage§protection: Protection

The protection used when mapping pages into this mapping

Implementations§

Source§

impl<R: Mappable> Mapping<R, Kernel>

Source

pub fn as_mut_ptr_range(&mut self) -> Range<*mut u8>

Source

pub fn as_ptr_range(&self) -> Range<*const u8>

Source

pub fn as_mut_ptr(&mut self) -> *mut u8

Source

pub fn as_ptr(&self) -> *const u8

Source

pub unsafe fn from_raw_parts<const RAM: bool, T>( frames: Frames<RAM, T>, base_page: RawPage, protection: Protection, caching: Caching, ) -> Self
where R: Default,

Source

pub fn into_raw_parts( self, ) -> (Option<Frames<false>>, RawPage, Protection, Caching)

Source§

impl<R: Mappable> Mapping<R, Userspace>

Source

pub fn as_mut_ptr_range(&mut self) -> Range<User<'_, *mut u8>>

Available on non-crate feature use_std only.
Source

pub fn as_ptr_range(&self) -> Range<User<'_, *const u8>>

Available on non-crate feature use_std only.
Source

pub fn as_mut_ptr(&mut self) -> User<'_, *mut u8>

Available on non-crate feature use_std only.
Source

pub fn as_ptr(&self) -> User<'_, *const u8>

Available on non-crate feature use_std only.
Source§

impl<R: Mappable, A: Ty> Mapping<R, A>

Source

pub fn grow_in_place_by( &mut self, extra_length: usize, ) -> Result<(), AllocError>

Source

pub fn byte_len(&self) -> usize

Source

pub fn page_len(&self) -> usize

Source

pub fn physical_start(&self) -> Option<RawFrame>

Source

pub fn virtual_valid_start(&self) -> RawPage

The first page in the mapping that is mapped to physical memory. The region of virtual memory from virtual_valid_start() to virtual_valid_start() + physical_length is mapped.

Source

pub fn set_writable(&mut self, writable: bool)

Trait Implementations§

Source§

impl<R: Mappable, A: Ty> Debug for Mapping<R, A>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<R: Mappable, A: Ty> Drop for Mapping<R, A>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<R, A> Freeze for Mapping<R, A>
where R: Freeze, A: Freeze,

§

impl<R, A> !RefUnwindSafe for Mapping<R, A>

§

impl<R, A> Send for Mapping<R, A>
where R: Send, A: Send,

§

impl<R, A> Sync for Mapping<R, A>
where R: Sync, A: Sync,

§

impl<R, A> Unpin for Mapping<R, A>
where R: Unpin, A: Unpin,

§

impl<R, A> UnsafeUnpin for Mapping<R, A>
where R: UnsafeUnpin, A: UnsafeUnpin,

§

impl<R, A> !UnwindSafe for Mapping<R, A>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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.
§

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

Performs the conversion.