#[repr(transparent)]pub struct MemoryKind(pub u64);Expand description
Memory region type identifier.
Used by the bootloader to communicate the memory map to the kernel. The kernel uses this to decide which regions can be used for the buddy allocator, which are reserved for hardware, etc.
§Example
ⓘ
let regions = /* from KernelArgs */;
for region in regions {
match region.kind {
MemoryKind::Free => {
// Add to buddy allocator
buddy_init_region(region.base, region.size);
}
MemoryKind::Reserved => {
// Skip — hardware MMIO (framebuffer, APIC, etc.)
}
MemoryKind::Reclaim => {
// Bootloader code — can be freed after init
reclaim_region(region.base, region.size);
}
_ => {}
}
}Tuple Fields§
§0: u64Implementations§
Source§impl MemoryKind
impl MemoryKind
Trait Implementations§
Source§impl Clone for MemoryKind
impl Clone for MemoryKind
Source§fn clone(&self) -> MemoryKind
fn clone(&self) -> MemoryKind
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for MemoryKind
Source§impl Debug for MemoryKind
impl Debug for MemoryKind
impl Eq for MemoryKind
Source§impl FromBytes for MemoryKindwhere
u64: FromBytes,
impl FromBytes for MemoryKindwhere
u64: FromBytes,
Source§impl FromZeros for MemoryKindwhere
u64: FromZeros,
impl FromZeros for MemoryKindwhere
u64: FromZeros,
Source§impl IntoBytes for MemoryKindwhere
u64: IntoBytes,
impl IntoBytes for MemoryKindwhere
u64: IntoBytes,
§fn as_mut_bytes(&mut self) -> &mut [u8]where
Self: FromBytes,
fn as_mut_bytes(&mut self) -> &mut [u8]where
Self: FromBytes,
Gets the bytes of this value mutably. Read more
Source§impl PartialEq for MemoryKind
impl PartialEq for MemoryKind
Source§fn eq(&self, other: &MemoryKind) -> bool
fn eq(&self, other: &MemoryKind) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for MemoryKind
Source§impl TryFromBytes for MemoryKindwhere
u64: TryFromBytes,
impl TryFromBytes for MemoryKindwhere
u64: TryFromBytes,
§fn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
§fn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
§fn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
Auto Trait Implementations§
impl Freeze for MemoryKind
impl RefUnwindSafe for MemoryKind
impl Send for MemoryKind
impl Sync for MemoryKind
impl Unpin for MemoryKind
impl UnsafeUnpin for MemoryKind
impl UnwindSafe for MemoryKind
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