mirror of
https://github.com/edera-dev/sprout.git
synced 2025-12-19 20:20:17 +00:00
introduce the use of anyhow to no longer use panic
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use anyhow::{Context, Result};
|
||||
use std::os::uefi as uefi_std;
|
||||
|
||||
pub fn init() {
|
||||
pub fn init() -> Result<()> {
|
||||
let system_table = uefi_std::env::system_table();
|
||||
let image_handle = uefi_std::env::image_handle();
|
||||
|
||||
@@ -10,9 +11,10 @@ pub fn init() {
|
||||
unsafe {
|
||||
uefi::table::set_system_table(system_table.as_ptr().cast());
|
||||
let handle = uefi::Handle::from_ptr(image_handle.as_ptr().cast())
|
||||
.expect("unable to resolve image handle");
|
||||
.context("unable to resolve image handle")?;
|
||||
uefi::boot::set_image_handle(handle);
|
||||
}
|
||||
|
||||
uefi::helpers::init().expect("failed to initialize uefi");
|
||||
uefi::helpers::init().context("failed to initialize uefi")?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user