Skip to content

Commit 0894142

Browse files
committed
uefi: Revising EFI Shell Protocol docstrings
1 parent 0f30078 commit 0894142

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

uefi/src/proto/shell/mod.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ use uefi_raw::Status;
1010

1111
use core::ptr;
1212

13-
pub use uefi_raw::protocol::shell::ShellProtocol;
13+
use uefi_raw::protocol::shell::ShellProtocol;
1414

1515
use crate::{CStr16, Char16};
1616

1717
/// Shell Protocol
1818
#[derive(Debug)]
1919
#[repr(transparent)]
20-
#[unsafe_protocol(uefi_raw::protocol::shell::ShellProtocol::GUID)]
21-
pub struct Shell(uefi_raw::protocol::shell::ShellProtocol);
20+
#[unsafe_protocol(ShellProtocol::GUID)]
21+
pub struct Shell(ShellProtocol);
2222

2323
impl Shell {
2424
/// Gets the environment variable or list of environment variables
@@ -27,16 +27,19 @@ impl Shell {
2727
///
2828
/// * `name` - The environment variable name of which to retrieve the
2929
/// value
30+
/// If specified and exists, will return a vector of length 1 containing
31+
/// the value of the specified environment variable
3032
/// If None, will return all defined shell environment
3133
/// variables
3234
///
3335
/// # Returns
3436
///
35-
/// * `Some(Vec<env_value>)` - Value of the environment variable
37+
/// * `Some(Vec<env_value>)` - Vector of length 1 containing the value of
38+
/// the environment variable
3639
/// * `Some(Vec<env_names>)` - Vector of environment variable names
3740
/// * `None` - Environment variable doesn't exist
3841
#[must_use]
39-
pub fn get_env<'a>(&'a self, name: Option<&CStr16>) -> Option<Vec<&'a CStr16>> {
42+
pub fn get_env(&self, name: Option<&CStr16>) -> Option<Vec<&CStr16>> {
4043
let mut env_vec = Vec::new();
4144
match name {
4245
Some(n) => {
@@ -92,7 +95,7 @@ impl Shell {
9295
///
9396
/// # Returns
9497
///
95-
/// * `Status::SUCCESS` The variable was successfully set
98+
/// * `Status::SUCCESS` - The variable was successfully set
9699
pub fn set_env(&self, name: &CStr16, value: &CStr16, volatile: bool) -> Status {
97100
let name_ptr: *const Char16 = core::ptr::from_ref::<CStr16>(name).cast();
98101
let value_ptr: *const Char16 = core::ptr::from_ref::<CStr16>(value).cast();
@@ -105,12 +108,13 @@ impl Shell {
105108
///
106109
/// * `file_system_mapping` - The file system mapping for which to get
107110
/// the current directory
111+
///
108112
/// # Returns
109113
///
110114
/// * `Some(cwd)` - CStr16 containing the current working directory
111115
/// * `None` - Could not retrieve current directory
112116
#[must_use]
113-
pub fn get_cur_dir<'a>(&'a self, file_system_mapping: Option<&CStr16>) -> Option<&'a CStr16> {
117+
pub fn get_cur_dir(&self, file_system_mapping: Option<&CStr16>) -> Option<&CStr16> {
114118
let mapping_ptr: *const Char16 = file_system_mapping.map_or(ptr::null(), |x| (x.as_ptr()));
115119
let cur_dir = unsafe { (self.0.get_cur_dir)(mapping_ptr.cast()) };
116120
if cur_dir.is_null() {
@@ -127,13 +131,14 @@ impl Shell {
127131
/// * `file_system` - Pointer to the file system's mapped name.
128132
/// * `directory` - Points to the directory on the device specified by
129133
/// `file_system`.
134+
///
130135
/// # Returns
131136
///
132-
/// * `Status::SUCCESS` The directory was successfully set
137+
/// * `Status::SUCCESS` - The directory was successfully set
133138
///
134139
/// # Errors
135140
///
136-
/// * `Status::EFI_NOT_FOUND` The directory does not exist
141+
/// * `Status::EFI_NOT_FOUND` - The directory does not exist
137142
pub fn set_cur_dir(&self, file_system: Option<&CStr16>, directory: Option<&CStr16>) -> Status {
138143
let fs_ptr: *const Char16 = file_system.map_or(ptr::null(), |x| (x.as_ptr()));
139144
let dir_ptr: *const Char16 = directory.map_or(ptr::null(), |x| (x.as_ptr()));

0 commit comments

Comments
 (0)