common:: utils:: UninitializedBuffer
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
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:
The static buffer is not used while uninitialized. Since the only way to get the necessary
&'static mut Tis to call
initialize(), the memory is guaranteed to be initialized.
A static buffer is not initialized twice. Since the underlying memory is owned by
UninitializedBuffernothing else can initialize it. Also, once the memory is initialized via
StaticUninitializedBuffer.initialize(), the internal buffer is consumed and
initialize()cannot be called again.
The only way to construct an
UninitializedBuffer is via this function,
which initializes it to
MaybeUninit::uninit(). This guarantees the
UninitializedBuffer does not contain an initialized
Auto Trait Implementations
impl<T> Send for UninitializedBuffer<T> where
impl<T> Sync for UninitializedBuffer<T> where
impl<T> Unpin for UninitializedBuffer<T> where
type Error = Infallible
The type returned in the event of a conversion error.