pub struct ConfigBuilder { /* private fields */ }
Expand description
A builder to configure a Config
§Example
use bootmgr_rs_core::config::builder::ConfigBuilder;
use uefi::{boot, proto::{device_path::DevicePath, loaded_image::LoadedImage, media::fs::SimpleFileSystem}};
let handle = {
let loaded_image =
boot::open_protocol_exclusive::<LoadedImage>(boot::image_handle()).expect("Failed to open LoadedImage on image");
let device_handle = loaded_image.device().expect("Image was not loaded from a filesystem");
let device_path = boot::open_protocol_exclusive::<DevicePath>(device_handle).expect("Failed to get device path from image filesystem");
boot::locate_device_path::<SimpleFileSystem>(&mut &*device_path).expect("Failed to get SimpleFileSystem on image filesystem")
};
let config = ConfigBuilder::new("foo.conf", ".conf")
.title("foo")
.fs_handle(handle)
.build();
Implementations§
Source§impl ConfigBuilder
impl ConfigBuilder
Sourcepub fn new(filename: impl Into<String>, suffix: impl Into<String>) -> Self
pub fn new(filename: impl Into<String>, suffix: impl Into<String>) -> Self
Constructs a new Config
.
Sourcepub fn machine_id(self, machine_id: impl Into<String>) -> Self
pub fn machine_id(self, machine_id: impl Into<String>) -> Self
Sets the machine id of a Config
.
This must be formatted as 32 lower case hexadecimal characters as defined in
BootLoaderSpec
. Otherwise, this will have no effect
Sourcepub fn sort_key(self, sort_key: impl Into<String>) -> Self
pub fn sort_key(self, sort_key: impl Into<String>) -> Self
Sets the sort key of a Config
Ideally, this should be entirely composed of lowercase characters, with nothing else other than numbers, dashes, underscores, and periods.
Sourcepub fn options(self, options: impl Into<String>) -> Self
pub fn options(self, options: impl Into<String>) -> Self
Sets the options of a Config
This essentially sets the LoadOptions
, or the command line of an EFI shell
Sourcepub fn devicetree_path(self, devicetree_path: impl Into<String>) -> Self
pub fn devicetree_path(self, devicetree_path: impl Into<String>) -> Self
Sets the devicetree of a Config
Sourcepub fn architecture(self, architecture: impl Into<String>) -> Self
pub fn architecture(self, architecture: impl Into<String>) -> Self
Sets the architecture of a Config
This is only used for filtering entries
Sourcepub const fn action(self, action: BootAction) -> Self
pub const fn action(self, action: BootAction) -> Self
Sets the BootAction
of a Config
This can be one of BootAction::BootEfi
, BootAction::BootTftp
, BootAction::Reboot
, BootAction::Shutdown
,
and BootAction::ResetToFirmware
. You should never need to use this