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
sourceimpl<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.
sourceimpl<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.
sourceimpl<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.
Trait Implementations
sourceimpl<System: KernelBase + KernelStatic, T: ?Sized> AsRef<T> for Hunk<System, T>
impl<System: KernelBase + KernelStatic, T: ?Sized> AsRef<T> for Hunk<System, T>
sourceimpl<System: KernelBase + KernelStatic, T: Debug + ?Sized> Debug for Hunk<System, T>
impl<System: KernelBase + KernelStatic, T: Debug + ?Sized> Debug for Hunk<System, T>
sourceimpl<System: KernelBase + KernelStatic, T: ?Sized> Deref for Hunk<System, T>
impl<System: KernelBase + KernelStatic, T: ?Sized> Deref for Hunk<System, T>
sourceimpl<System: KernelBase + KernelStatic, T> Init for Hunk<System, [T]>
impl<System: KernelBase + KernelStatic, T> Init for Hunk<System, [T]>
impl<System: KernelBase + KernelStatic, T: ?Sized> CloneStableDeref for Hunk<System, T>
impl<System, T: ?Sized> Copy for Hunk<System, T>
impl<System, T: ?Sized + Send> Send for Hunk<System, T>
impl<System: KernelBase + KernelStatic, T: ?Sized> StableDeref for Hunk<System, T>
impl<System, T: ?Sized + Sync> Sync for Hunk<System, T>
Auto Trait Implementations
impl<System, T: ?Sized> RefUnwindSafe for Hunk<System, T>where
System: RefUnwindSafe,
T: RefUnwindSafe,
impl<System, T: ?Sized> Unpin for Hunk<System, T>where
System: Unpin,
impl<System, T: ?Sized> UnwindSafe for Hunk<System, T>where
System: UnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more