pub struct Hunk<System, T: ?Sized> { /* private fields */ }Expand description
Represents a single typed hunk in a system.
Hunks are nothing more than static variables defined in a kernel configuration. They come in handy when you are designing a component that can be instantiated by a kernel configuration and wanting each instance to have its own separate state data.
This type is implemented on top of r3::kernel::Hunk, the untyped
hunk type.
Implementations§
source§impl<System: KernelBase + KernelStatic, T: ?Sized> Hunk<System, T>
 
impl<System: KernelBase + KernelStatic, T: ?Sized> Hunk<System, T>
sourcepub const fn define() -> HunkDefiner<System, T, DefaultInitTag>
 
pub const fn define() -> HunkDefiner<System, T, DefaultInitTag>
Construct a HunkDefiner to define a hunk in a configuration
function.
source§impl<System, T: ?Sized> Hunk<System, T>
 
impl<System, T: ?Sized> Hunk<System, T>
sourcepub const unsafe fn transmute<U>(self) -> Hunk<System, U>
 
pub const unsafe fn transmute<U>(self) -> Hunk<System, U>
Reinterpret the hunk as another type.
Safety
- Similarly to core::mem::transmute, this is incredibly unsafe.
- The byte offset must be valid for the destination type.
sourcepub const unsafe fn wrapping_offset(self, count: isize) -> Selfwhere
    T: Sized,
 
pub const unsafe fn wrapping_offset(self, count: isize) -> Selfwhere T: Sized,
Calculate the offset from the hunk.
Safety
- The resulting hunk may point to memory that the caller is not supposed to access.
source§impl<System: KernelBase + KernelStatic, T: ?Sized> Hunk<System, T>
 
impl<System: KernelBase + KernelStatic, T: ?Sized> Hunk<System, T>
sourcepub fn untyped_hunk(this: Self) -> Hunk<System>
 
pub fn untyped_hunk(this: Self) -> Hunk<System>
Get the untyped hunk.
sourcepub fn as_bytes_ptr(this: Self) -> *const [u8]
 
pub fn as_bytes_ptr(this: Self) -> *const [u8]
Get a raw pointer to the raw bytes of the hunk.