mirror of
https://github.com/edera-dev/sprout.git
synced 2025-12-19 10:30:17 +00:00
fix(sprout): correct rustdoc and clarify safety in some places
This commit is contained in:
@@ -64,7 +64,8 @@ pub fn chainload(context: Rc<SproutContext>, configuration: &ChainloadConfigurat
|
||||
// Pass the options to the image, if any are provided.
|
||||
// The holder must drop at the end of this function to ensure the options are not leaked,
|
||||
// and the holder here ensures it outlives the if block here, as a pointer has to be
|
||||
// passed to the image. This has been hand-validated to be safe.
|
||||
// passed to the image.
|
||||
// SAFETY: The options outlive the usage of the image, and the image is not used after this.
|
||||
let mut options_holder: Option<Box<CString16>> = None;
|
||||
if !options.is_empty() {
|
||||
let options = Box::new(
|
||||
@@ -103,7 +104,7 @@ pub fn chainload(context: Rc<SproutContext>, configuration: &ChainloadConfigurat
|
||||
// This call might return, or it may pass full control to another image that will never return.
|
||||
// Capture the result to ensure we can return an error if the image fails to start, but only
|
||||
// after the optional initrd has been unregistered.
|
||||
let result = uefi::boot::start_image(image).context("unable to start image");
|
||||
let result = uefi::boot::start_image(image);
|
||||
|
||||
// Unregister the initrd if it was registered.
|
||||
if let Some(initrd_handle) = initrd_handle
|
||||
|
||||
@@ -118,7 +118,10 @@ impl SproutContext {
|
||||
pub fn all_values(&self) -> BTreeMap<String, String> {
|
||||
let mut values = BTreeMap::new();
|
||||
for key in self.all_keys() {
|
||||
values.insert(key.clone(), self.get(key).cloned().unwrap_or_default());
|
||||
// Acquire the value from the context. Since retrieving all the keys will give us
|
||||
// a full view of the context, we can be sure that the key exists.
|
||||
let value = self.get(&key).cloned().unwrap_or_default();
|
||||
values.insert(key.clone(), value);
|
||||
}
|
||||
values
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ use uefi_raw::Status;
|
||||
/// the device root path that can concatenated with subpaths to access files
|
||||
/// on a particular filesystem.
|
||||
///
|
||||
/// This function only requires one of the criteria to match.
|
||||
/// This function only requires all the criteria to match.
|
||||
/// The fallback value can be used to provide a value if none is found.
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone)]
|
||||
pub struct FilesystemDeviceMatchExtractor {
|
||||
|
||||
Reference in New Issue
Block a user