pub struct Variable { /* private fields */ }Expand description
Represents an EFI variable, with a name and a vendor (namespace)
§Examples
Parsing a valid variable into succeeds:
let var = Variable::from_str("BootOrder-8be4df61-93ca-11d2-aa0d-00e098032b8c").unwrap();
assert_eq!(*var.vendor().as_ref(), uuid::Uuid::from_str("8be4df61-93ca-11d2-aa0d-00e098032b8c").unwrap());
assert_eq!(var.name(), "BootOrder");Parsing an invalid name fails:
let result = Variable::from_str("invalid variable");
assert!(result.is_err());Turning the structure back into a string:
let var = Variable::new("BootOrder");
assert_eq!(var.to_string(), "BootOrder-8be4df61-93ca-11d2-aa0d-00e098032b8c");Implementations§
Source§impl Variable
impl Variable
Sourcepub fn new_with_vendor<V: Into<VariableVendor>>(name: &str, vendor: V) -> Self
pub fn new_with_vendor<V: Into<VariableVendor>>(name: &str, vendor: V) -> Self
Create a new custom vendor variable
§Parameters
name: name of the variablevendor: vendor identifier
Sourcepub fn vendor(&self) -> &VariableVendor
pub fn vendor(&self) -> &VariableVendor
Get the vendor for this instance
Sourcepub fn short_name(&self) -> String
pub fn short_name(&self) -> String
Return a short version of the variable as a String
Sourcepub fn boot_var_id(&self) -> Option<u16>
pub fn boot_var_id(&self) -> Option<u16>
Returns the boot var ID (4 digits hex number) if this variable is a boot entry. Else, return None
Trait Implementations§
impl Eq for Variable
impl StructuralPartialEq for Variable
Auto Trait Implementations§
impl Freeze for Variable
impl RefUnwindSafe for Variable
impl Send for Variable
impl Sync for Variable
impl Unpin for Variable
impl UnsafeUnpin for Variable
impl UnwindSafe for Variable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more