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

#[repr(transparent)]pub struct UninitializedBuffer<T>(_);

The UninitializedBuffer type is designed to be statically allocated as a global buffer to hold data structures in Tock. As a static, global buffer the data structure can then be shared in the Tock kernel.

This type is implemented as a wrapper around a MaybeUninit<T> buffer. To enforce that the global static buffer is initialized exactly once, this wrapper type ensures that the underlying memory is uninitialized so that an UninitializedBuffer does not contain an initialized value.

The only way to initialize this buffer is to create a StaticUninitializedBuffer, pass the UninitializedBuffer to it, and call initialize(). This structure ensures that:

  1. The static buffer is not used while uninitialized. Since the only way to get the necessary &'static mut T is to call initialize(), the memory is guaranteed to be initialized.

  2. A static buffer is not initialized twice. Since the underlying memory is owned by UninitializedBuffer nothing else can initialize it. Also, once the memory is initialized via StaticUninitializedBuffer.initialize(), the internal buffer is consumed and initialize() cannot be called again.

Implementations

impl<T> UninitializedBuffer<T>[src]

pub const fn new() -> Self[src]

The only way to construct an UninitializedBuffer is via this function, which initializes it to MaybeUninit::uninit(). This guarantees the invariant that UninitializedBuffer does not contain an initialized value.

Auto Trait Implementations

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

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

impl<T> Unpin for UninitializedBuffer<T> where
    T: Unpin

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.