pub struct BLSEntry {
Show 16 fields pub title: Option<BLSValue>, pub version: Option<BLSValue>, pub machine_id: Option<BLSValue>, pub sort_key: Option<BLSValue>, pub linux: BLSValue, pub efi: Option<BLSValue>, pub initrd: Vec<BLSValue>, pub options: Vec<BLSValue>, pub devicetree: Option<BLSValue>, pub devicetree_overlay: Option<BLSValue>, pub architecture: Option<BLSValue>, pub grub_hotkey: Option<BLSValue>, pub grub_users: Option<BLSValue>, pub grub_class: Vec<BLSValue>, pub grub_arg: Option<BLSValue>, pub comments: Vec<String>,
}
Expand description

BLSEntry represents the contents of a BLS entry file

Fields

title: Option<BLSValue>version: Option<BLSValue>machine_id: Option<BLSValue>sort_key: Option<BLSValue>linux: BLSValueefi: Option<BLSValue>initrd: Vec<BLSValue>options: Vec<BLSValue>devicetree: Option<BLSValue>devicetree_overlay: Option<BLSValue>architecture: Option<BLSValue>grub_hotkey: Option<BLSValue>grub_users: Option<BLSValue>grub_class: Vec<BLSValue>grub_arg: Option<BLSValue>comments: Vec<String>

Implementations

Allocates a new instance of BLSEntry, all optional members are initialized to None and linux is set with an empty string

Parses a Boot Loader Spec entry UTF-8 buffer, returns a BLSEntry instance if successful, an error String if there was an error Note that any comment lines that are then rendered using BLSEntry::parse() will be pushed to the header of the file as the order commands and comments are not preserved.

Renders the BLSEntry content into a UTF-8 String

Sets a value for a given key

Arguments
  • key: a &str representing the key to be set
  • value: a String representing the value for the key
  • comment: an optional String reprensenting an inline comment for the value
  • set_policy: Some keys can hold multiple values, the ValueSetPolicy enum specifies the policy for keys that can be specified multiple times.
Returns

Ok(()) if the key was succesfully set.

Errors

Returns an Err(String) if an invalid key is set.

Panics

If ValueSetPolicy::InsertAt(usize) is used as set_policy it may cause a panic if the index is out of bound

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.