[][src]Struct kernel::common::utils::StaticUninitializedBuffer

pub struct StaticUninitializedBuffer<T: 'static> { /* fields omitted */ }

The StaticUninitializedBuffer type represents a statically allocated buffer that can be converted to another type once it has been initialized. Upon initialization, a static mutable reference is returned and the StaticUninitializedBuffer is consumed.

This type is implemented as a wrapper containing a static mutable reference to an UninitializedBuffer. This guarantees that the memory pointed to by the reference has not already been initialized.

StaticUninitializedBuffer provides one operation: initialize() that returns a &'static mut T reference. This is the only way to get the reference, and ensures that the underlying uninitialized buffer is properly initialized. The wrapper is also consumed when initialize() is called, ensuring that the underlying memory cannot be subsequently re-initialized.

Implementations

impl<T> StaticUninitializedBuffer<T>[src]

pub fn new(buf: &'static mut UninitializedBuffer<T>) -> Self[src]

This function is not intended to be called publicly. It's only meant to be called within static_buf! macro, but Rust's visibility rules require it to be public, so that the macro's body can be instantiated.

pub unsafe fn initialize(self, value: T) -> &'static mut T[src]

This function consumes an uninitialized static buffer, initializes it to some value, and returns a static mutable reference to it. This allows for runtime initialization of static values that do not have a const constructor.

Auto Trait Implementations

impl<T> Send for StaticUninitializedBuffer<T> where
    T: Send

impl<T> Sync for StaticUninitializedBuffer<T> where
    T: Sync

impl<T> Unpin for StaticUninitializedBuffer<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.