pub struct Hunk<System, T>where
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, T> Hunk<System, T>where
System: KernelBase + KernelStatic<System>,
T: ?Sized,
impl<System, T> Hunk<System, T>where System: KernelBase + KernelStatic<System>, T: ?Sized,
sourcepub const fn define() -> HunkDefiner<System, T, DefaultInitTag>
Available on crate feature sync
only.
pub const fn define() -> HunkDefiner<System, T, DefaultInitTag>
sync
only.Construct a HunkDefiner
to define a hunk in a configuration
function.
source§impl<System, T> Hunk<System, T>where
T: ?Sized,
impl<System, T> Hunk<System, T>where T: ?Sized,
sourcepub const unsafe fn transmute<U>(self) -> Hunk<System, U>
Available on crate feature sync
only.
pub const unsafe fn transmute<U>(self) -> Hunk<System, U>
sync
only.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) -> Hunk<System, T>
Available on crate feature sync
only.
pub const unsafe fn wrapping_offset(self, count: isize) -> Hunk<System, T>
sync
only.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, T> Hunk<System, T>where
System: KernelBase + KernelStatic<System>,
T: ?Sized,
impl<System, T> Hunk<System, T>where System: KernelBase + KernelStatic<System>, T: ?Sized,
sourcepub fn untyped_hunk(this: Hunk<System, T>) -> Hunk<System>
Available on crate feature sync
only.
pub fn untyped_hunk(this: Hunk<System, T>) -> Hunk<System>
sync
only.Get the untyped hunk.
sourcepub fn as_ptr(this: Hunk<System, T>) -> *const T
Available on crate feature sync
only.
pub fn as_ptr(this: Hunk<System, T>) -> *const T
sync
only.Get a raw pointer to the hunk’s contents.
sourcepub fn as_bytes_ptr(this: Hunk<System, T>) -> *const [u8]
Available on crate feature sync
only.
pub fn as_bytes_ptr(this: Hunk<System, T>) -> *const [u8]
sync
only.Get a raw pointer to the raw bytes of the hunk.