pub trait UefiVariable: Sized {
const SIZE: usize;
// Required methods
fn to_bytes(&self, out: &mut [u8]) -> usize;
fn from_bytes(bytes: &[u8]) -> Self;
fn default() -> Self;
}
Expand description
A value that can be stored in a UEFI variable.
This is essentially a type that can be converted into and from a vector of bytes. What byte ordering these bytes
are in does not particularly matter, or how these bytes are encoded or decoded, as long as the method from
UefiVariable
is used instead of whatever type you have. It also has to be a set size.
Required Associated Constants§
Required Methods§
Sourcefn to_bytes(&self, out: &mut [u8]) -> usize
fn to_bytes(&self, out: &mut [u8]) -> usize
Convert Self
to a buffer of bytes, then return the bytes written.
Sourcefn from_bytes(bytes: &[u8]) -> Self
fn from_bytes(bytes: &[u8]) -> Self
Convert a vector of bytes to Self
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.