@@ -10,15 +10,15 @@ use uefi_raw::Status;
10
10
11
11
use core:: ptr;
12
12
13
- pub use uefi_raw:: protocol:: shell:: ShellProtocol ;
13
+ use uefi_raw:: protocol:: shell:: ShellProtocol ;
14
14
15
15
use crate :: { CStr16 , Char16 } ;
16
16
17
17
/// Shell Protocol
18
18
#[ derive( Debug ) ]
19
19
#[ 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 ) ;
22
22
23
23
impl Shell {
24
24
/// Gets the environment variable or list of environment variables
@@ -27,16 +27,19 @@ impl Shell {
27
27
///
28
28
/// * `name` - The environment variable name of which to retrieve the
29
29
/// value
30
+ /// If specified and exists, will return a vector of length 1 containing
31
+ /// the value of the specified environment variable
30
32
/// If None, will return all defined shell environment
31
33
/// variables
32
34
///
33
35
/// # Returns
34
36
///
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
36
39
/// * `Some(Vec<env_names>)` - Vector of environment variable names
37
40
/// * `None` - Environment variable doesn't exist
38
41
#[ 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 > > {
40
43
let mut env_vec = Vec :: new ( ) ;
41
44
match name {
42
45
Some ( n) => {
@@ -92,7 +95,7 @@ impl Shell {
92
95
///
93
96
/// # Returns
94
97
///
95
- /// * `Status::SUCCESS` The variable was successfully set
98
+ /// * `Status::SUCCESS` - The variable was successfully set
96
99
pub fn set_env ( & self , name : & CStr16 , value : & CStr16 , volatile : bool ) -> Status {
97
100
let name_ptr: * const Char16 = core:: ptr:: from_ref :: < CStr16 > ( name) . cast ( ) ;
98
101
let value_ptr: * const Char16 = core:: ptr:: from_ref :: < CStr16 > ( value) . cast ( ) ;
@@ -105,12 +108,13 @@ impl Shell {
105
108
///
106
109
/// * `file_system_mapping` - The file system mapping for which to get
107
110
/// the current directory
111
+ ///
108
112
/// # Returns
109
113
///
110
114
/// * `Some(cwd)` - CStr16 containing the current working directory
111
115
/// * `None` - Could not retrieve current directory
112
116
#[ 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 > {
114
118
let mapping_ptr: * const Char16 = file_system_mapping. map_or ( ptr:: null ( ) , |x| ( x. as_ptr ( ) ) ) ;
115
119
let cur_dir = unsafe { ( self . 0 . get_cur_dir ) ( mapping_ptr. cast ( ) ) } ;
116
120
if cur_dir. is_null ( ) {
@@ -127,13 +131,14 @@ impl Shell {
127
131
/// * `file_system` - Pointer to the file system's mapped name.
128
132
/// * `directory` - Points to the directory on the device specified by
129
133
/// `file_system`.
134
+ ///
130
135
/// # Returns
131
136
///
132
- /// * `Status::SUCCESS` The directory was successfully set
137
+ /// * `Status::SUCCESS` - The directory was successfully set
133
138
///
134
139
/// # Errors
135
140
///
136
- /// * `Status::EFI_NOT_FOUND` The directory does not exist
141
+ /// * `Status::EFI_NOT_FOUND` - The directory does not exist
137
142
pub fn set_cur_dir ( & self , file_system : Option < & CStr16 > , directory : Option < & CStr16 > ) -> Status {
138
143
let fs_ptr: * const Char16 = file_system. map_or ( ptr:: null ( ) , |x| ( x. as_ptr ( ) ) ) ;
139
144
let dir_ptr: * const Char16 = directory. map_or ( ptr:: null ( ) , |x| ( x. as_ptr ( ) ) ) ;
0 commit comments