Struct kernel::memory_management::virtual_space::VirtualSpace
source · pub struct VirtualSpace<T: ?Sized> {
size: usize,
data: NonNull<T>,
}
Expand description
A wrapper over memory that is defined by its physical address
.
We map this memory in virtual space
, and return a pointer to it.
Fields§
§size: usize
§data: NonNull<T>
Implementations§
source§impl<T> VirtualSpace<T>
impl<T> VirtualSpace<T>
sourcepub unsafe fn new(physical_start: u64) -> Result<Self, VirtualSpaceError>
pub unsafe fn new(physical_start: u64) -> Result<Self, VirtualSpaceError>
Create a new virtual space for the given physical_start
on the given type T
.
Safety
- Must be a valid physical address
- The memory must be defined by default. if its not, use
new_uninit
instead
sourcepub unsafe fn new_uninit(
physical_start: u64
) -> Result<VirtualSpace<MaybeUninit<T>>, VirtualSpaceError>
pub unsafe fn new_uninit( physical_start: u64 ) -> Result<VirtualSpace<MaybeUninit<T>>, VirtualSpaceError>
Create a new virtual space for the given physical_start
on the given type T
.
But will assume that the memory is not initialized, and will return a MaybeUninit
pointer.
Safety
- Must be a valid physical address
sourcepub unsafe fn new_slice(
physical_start: u64,
len: usize
) -> Result<VirtualSpace<[T]>, VirtualSpaceError>
pub unsafe fn new_slice( physical_start: u64, len: usize ) -> Result<VirtualSpace<[T]>, VirtualSpaceError>
Create a new virtual space for the given physical_start
on the given slice type [T]
.
Safety
- Must be a valid physical address
- The memory must be defined by default. currently, there is no way to create a slice of
MaybeUninit
Trait Implementations§
source§impl<T: ?Sized> Deref for VirtualSpace<T>
impl<T: ?Sized> Deref for VirtualSpace<T>
source§impl<T: ?Sized> DerefMut for VirtualSpace<T>
impl<T: ?Sized> DerefMut for VirtualSpace<T>
source§impl<T: ?Sized> Drop for VirtualSpace<T>
impl<T: ?Sized> Drop for VirtualSpace<T>
impl<T: ?Sized + Send> Send for VirtualSpace<T>
impl<T: ?Sized + Sync> Sync for VirtualSpace<T>
Auto Trait Implementations§
impl<T: ?Sized> RefUnwindSafe for VirtualSpace<T>where
T: RefUnwindSafe,
impl<T: ?Sized> Unpin for VirtualSpace<T>
impl<T: ?Sized> UnwindSafe for VirtualSpace<T>where
T: RefUnwindSafe,
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
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.