Trait firmware_uefi::platform::nvram::NvramStorage

source ·
pub trait NvramStorage: Send + Sync {
    // Required methods
    fn get_variable<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        name: &'life1 Ucs2LeSlice,
        vendor: Guid,
    ) -> Pin<Box<dyn Future<Output = Result<Option<(u32, Vec<u8>, EFI_TIME)>, NvramStorageError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn set_variable<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        name: &'life1 Ucs2LeSlice,
        vendor: Guid,
        attr: u32,
        data: Vec<u8>,
        timestamp: EFI_TIME,
    ) -> Pin<Box<dyn Future<Output = Result<(), NvramStorageError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn append_variable<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        name: &'life1 Ucs2LeSlice,
        vendor: Guid,
        data: Vec<u8>,
        timestamp: EFI_TIME,
    ) -> Pin<Box<dyn Future<Output = Result<bool, NvramStorageError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn remove_variable<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        name: &'life1 Ucs2LeSlice,
        vendor: Guid,
    ) -> Pin<Box<dyn Future<Output = Result<bool, NvramStorageError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn next_variable<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        name_vendor: Option<(&'life1 Ucs2LeSlice, Guid)>,
    ) -> Pin<Box<dyn Future<Output = Result<NextVariable, NvramStorageError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;

    // Provided method
    fn is_empty<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<bool, NvramStorageError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait { ... }
}
Expand description

Abstraction over persistent nvram variable storage (e.g: in-memory, file-backed, vmgs-backed, etc.).

Implementors of this interface are not required to perform attribute validation, and should simply store/retrieve data.

Required Methods§

source

fn get_variable<'life0, 'life1, 'async_trait>( &'life0 mut self, name: &'life1 Ucs2LeSlice, vendor: Guid, ) -> Pin<Box<dyn Future<Output = Result<Option<(u32, Vec<u8>, EFI_TIME)>, NvramStorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Return the attr + data of the variable identified by name + vendor.

source

fn set_variable<'life0, 'life1, 'async_trait>( &'life0 mut self, name: &'life1 Ucs2LeSlice, vendor: Guid, attr: u32, data: Vec<u8>, timestamp: EFI_TIME, ) -> Pin<Box<dyn Future<Output = Result<(), NvramStorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Set the value of variable identified by name + vendor to the provided attr + data.

This method will persist any modifications to a backing data store.

source

fn append_variable<'life0, 'life1, 'async_trait>( &'life0 mut self, name: &'life1 Ucs2LeSlice, vendor: Guid, data: Vec<u8>, timestamp: EFI_TIME, ) -> Pin<Box<dyn Future<Output = Result<bool, NvramStorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Append data to a variable identified by name + vendor from the Nvram storage.

Returns true if the variable was appended to, or false if it could not be found.

This method will persist any modifications to a backing data store.

source

fn remove_variable<'life0, 'life1, 'async_trait>( &'life0 mut self, name: &'life1 Ucs2LeSlice, vendor: Guid, ) -> Pin<Box<dyn Future<Output = Result<bool, NvramStorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Remove a variable identified by name + vendor from the Nvram storage.

Returns true if the variable was removed, or false if it could not be found.

This method will persist any modifications to a backing data store.

source

fn next_variable<'life0, 'life1, 'async_trait>( &'life0 mut self, name_vendor: Option<(&'life1 Ucs2LeSlice, Guid)>, ) -> Pin<Box<dyn Future<Output = Result<NextVariable, NvramStorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Return the variable key immediately after the variable identified by name + vendor. If name_vendor is None, return the first variable.

Provided Methods§

source

fn is_empty<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<bool, NvramStorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Return true if the underlying store doesn’t contain any vars

Trait Implementations§

source§

impl NvramStorage for Box<dyn NvramStorage>

source§

fn get_variable<'life0, 'life1, 'async_trait>( &'life0 mut self, name: &'life1 Ucs2LeSlice, vendor: Guid, ) -> Pin<Box<dyn Future<Output = Result<Option<(u32, Vec<u8>, EFI_TIME)>, NvramStorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Box<dyn NvramStorage>: 'async_trait,

Return the attr + data of the variable identified by name + vendor.
source§

fn set_variable<'life0, 'life1, 'async_trait>( &'life0 mut self, name: &'life1 Ucs2LeSlice, vendor: Guid, attr: u32, data: Vec<u8>, timestamp: EFI_TIME, ) -> Pin<Box<dyn Future<Output = Result<(), NvramStorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Box<dyn NvramStorage>: 'async_trait,

Set the value of variable identified by name + vendor to the provided attr + data. Read more
source§

fn append_variable<'life0, 'life1, 'async_trait>( &'life0 mut self, name: &'life1 Ucs2LeSlice, vendor: Guid, data: Vec<u8>, timestamp: EFI_TIME, ) -> Pin<Box<dyn Future<Output = Result<bool, NvramStorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Box<dyn NvramStorage>: 'async_trait,

Append data to a variable identified by name + vendor from the Nvram storage. Read more
source§

fn remove_variable<'life0, 'life1, 'async_trait>( &'life0 mut self, name: &'life1 Ucs2LeSlice, vendor: Guid, ) -> Pin<Box<dyn Future<Output = Result<bool, NvramStorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Box<dyn NvramStorage>: 'async_trait,

Remove a variable identified by name + vendor from the Nvram storage. Read more
source§

fn next_variable<'life0, 'life1, 'async_trait>( &'life0 mut self, name_vendor: Option<(&'life1 Ucs2LeSlice, Guid)>, ) -> Pin<Box<dyn Future<Output = Result<NextVariable, NvramStorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Box<dyn NvramStorage>: 'async_trait,

Return the variable key immediately after the variable identified by name + vendor. If name_vendor is None, return the first variable.
source§

fn is_empty<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<bool, NvramStorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Return true if the underlying store doesn’t contain any vars

Implementations on Foreign Types§

source§

impl NvramStorage for Box<dyn InspectableNvramStorage>

source§

fn get_variable<'life0, 'life1, 'async_trait>( &'life0 mut self, name: &'life1 Ucs2LeSlice, vendor: Guid, ) -> Pin<Box<dyn Future<Output = Result<Option<(u32, Vec<u8>, EFI_TIME)>, NvramStorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Box<dyn InspectableNvramStorage>: 'async_trait,

source§

fn set_variable<'life0, 'life1, 'async_trait>( &'life0 mut self, name: &'life1 Ucs2LeSlice, vendor: Guid, attr: u32, data: Vec<u8>, timestamp: EFI_TIME, ) -> Pin<Box<dyn Future<Output = Result<(), NvramStorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Box<dyn InspectableNvramStorage>: 'async_trait,

source§

fn append_variable<'life0, 'life1, 'async_trait>( &'life0 mut self, name: &'life1 Ucs2LeSlice, vendor: Guid, data: Vec<u8>, timestamp: EFI_TIME, ) -> Pin<Box<dyn Future<Output = Result<bool, NvramStorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Box<dyn InspectableNvramStorage>: 'async_trait,

source§

fn remove_variable<'life0, 'life1, 'async_trait>( &'life0 mut self, name: &'life1 Ucs2LeSlice, vendor: Guid, ) -> Pin<Box<dyn Future<Output = Result<bool, NvramStorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Box<dyn InspectableNvramStorage>: 'async_trait,

source§

fn next_variable<'life0, 'life1, 'async_trait>( &'life0 mut self, name_vendor: Option<(&'life1 Ucs2LeSlice, Guid)>, ) -> Pin<Box<dyn Future<Output = Result<NextVariable, NvramStorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Box<dyn InspectableNvramStorage>: 'async_trait,

source§

impl NvramStorage for Box<dyn NvramStorage>

source§

fn get_variable<'life0, 'life1, 'async_trait>( &'life0 mut self, name: &'life1 Ucs2LeSlice, vendor: Guid, ) -> Pin<Box<dyn Future<Output = Result<Option<(u32, Vec<u8>, EFI_TIME)>, NvramStorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Box<dyn NvramStorage>: 'async_trait,

source§

fn set_variable<'life0, 'life1, 'async_trait>( &'life0 mut self, name: &'life1 Ucs2LeSlice, vendor: Guid, attr: u32, data: Vec<u8>, timestamp: EFI_TIME, ) -> Pin<Box<dyn Future<Output = Result<(), NvramStorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Box<dyn NvramStorage>: 'async_trait,

source§

fn append_variable<'life0, 'life1, 'async_trait>( &'life0 mut self, name: &'life1 Ucs2LeSlice, vendor: Guid, data: Vec<u8>, timestamp: EFI_TIME, ) -> Pin<Box<dyn Future<Output = Result<bool, NvramStorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Box<dyn NvramStorage>: 'async_trait,

source§

fn remove_variable<'life0, 'life1, 'async_trait>( &'life0 mut self, name: &'life1 Ucs2LeSlice, vendor: Guid, ) -> Pin<Box<dyn Future<Output = Result<bool, NvramStorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Box<dyn NvramStorage>: 'async_trait,

source§

fn next_variable<'life0, 'life1, 'async_trait>( &'life0 mut self, name_vendor: Option<(&'life1 Ucs2LeSlice, Guid)>, ) -> Pin<Box<dyn Future<Output = Result<NextVariable, NvramStorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Box<dyn NvramStorage>: 'async_trait,

Implementors§