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: BLSValue
§efi: 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§
Source§impl BLSEntry
impl BLSEntry
Sourcepub fn new() -> BLSEntry
pub fn new() -> BLSEntry
Allocates a new instance of BLSEntry, all optional members are initialized to None and linux
is set with an empty string
Sourcepub fn parse(buffer: &str) -> Result<BLSEntry, String>
pub fn parse(buffer: &str) -> Result<BLSEntry, 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.
Sourcepub fn set(
&mut self,
key: BLSKey,
value: String,
comment: Option<String>,
set_policy: ValueSetPolicy,
)
pub fn set( &mut self, key: BLSKey, value: String, comment: Option<String>, set_policy: ValueSetPolicy, )
Sets a value for a given key
§Arguments
key
: a &str representing the key to be setvalue
: a String representing the value for the keycomment
: an optional String reprensenting an inline comment for the valueset_policy
: Some keys can hold multiple values, theValueSetPolicy
enum specifies the policy for keys that can be specified multiple times.
§Panics
If ValueSetPolicy::InsertAt(usize)
is used as set_policy
it may cause a panic if the index is out of bound
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BLSEntry
impl RefUnwindSafe for BLSEntry
impl Send for BLSEntry
impl Sync for BLSEntry
impl Unpin for BLSEntry
impl UnwindSafe for BLSEntry
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