1
+ use uefi:: boot:: { self , ScopedProtocol , SearchType } ;
1
2
use uefi:: prelude:: * ;
2
3
use uefi:: proto:: driver:: { ComponentName , ComponentName2 , LanguageError , LanguageIter } ;
3
- use uefi:: table:: boot:: { ScopedProtocol , SearchType } ;
4
4
use uefi:: { CStr16 , Result } ;
5
5
6
6
#[ allow( deprecated) ]
7
7
use uefi:: proto:: driver:: ComponentName1 ;
8
8
9
9
/// Generic interface for testing `ComponentName1`, `ComponentName2`, and
10
10
/// `ComponentName`.
11
- trait ComponentNameInterface < ' a > : Sized {
12
- fn open ( boot_services : & ' a BootServices , handle : Handle ) -> Result < Self > ;
11
+ trait ComponentNameInterface : Sized {
12
+ fn open ( handle : Handle ) -> Result < Self > ;
13
13
fn supported_languages ( & self ) -> core:: result:: Result < LanguageIter , LanguageError > ;
14
14
fn driver_name ( & self , language : & str ) -> Result < & CStr16 > ;
15
15
fn controller_name (
@@ -21,9 +21,9 @@ trait ComponentNameInterface<'a>: Sized {
21
21
}
22
22
23
23
#[ allow( deprecated) ]
24
- impl < ' a > ComponentNameInterface < ' a > for ScopedProtocol < ' a , ComponentName1 > {
25
- fn open ( boot_services : & ' a BootServices , handle : Handle ) -> Result < Self > {
26
- boot_services . open_protocol_exclusive :: < ComponentName1 > ( handle)
24
+ impl ComponentNameInterface for ScopedProtocol < ComponentName1 > {
25
+ fn open ( handle : Handle ) -> Result < Self > {
26
+ boot :: open_protocol_exclusive :: < ComponentName1 > ( handle)
27
27
}
28
28
29
29
fn supported_languages ( & self ) -> core:: result:: Result < LanguageIter , LanguageError > {
@@ -44,9 +44,9 @@ impl<'a> ComponentNameInterface<'a> for ScopedProtocol<'a, ComponentName1> {
44
44
}
45
45
}
46
46
47
- impl < ' a > ComponentNameInterface < ' a > for ScopedProtocol < ' a , ComponentName2 > {
48
- fn open ( boot_services : & ' a BootServices , handle : Handle ) -> Result < Self > {
49
- boot_services . open_protocol_exclusive :: < ComponentName2 > ( handle)
47
+ impl ComponentNameInterface for ScopedProtocol < ComponentName2 > {
48
+ fn open ( handle : Handle ) -> Result < Self > {
49
+ boot :: open_protocol_exclusive :: < ComponentName2 > ( handle)
50
50
}
51
51
52
52
fn supported_languages ( & self ) -> core:: result:: Result < LanguageIter , LanguageError > {
@@ -67,9 +67,9 @@ impl<'a> ComponentNameInterface<'a> for ScopedProtocol<'a, ComponentName2> {
67
67
}
68
68
}
69
69
70
- impl < ' a > ComponentNameInterface < ' a > for ComponentName < ' a > {
71
- fn open ( boot_services : & ' a BootServices , handle : Handle ) -> Result < Self > {
72
- Self :: open ( boot_services , handle)
70
+ impl ComponentNameInterface for ComponentName {
71
+ fn open ( handle : Handle ) -> Result < Self > {
72
+ Self :: open ( handle)
73
73
}
74
74
75
75
fn supported_languages ( & self ) -> core:: result:: Result < LanguageIter , LanguageError > {
@@ -90,13 +90,8 @@ impl<'a> ComponentNameInterface<'a> for ComponentName<'a> {
90
90
}
91
91
}
92
92
93
- fn test_component_name < ' a , C : ComponentNameInterface < ' a > > (
94
- boot_services : & ' a BootServices ,
95
- english : & str ,
96
- ) {
97
- let all_handles = boot_services
98
- . locate_handle_buffer ( SearchType :: AllHandles )
99
- . unwrap ( ) ;
93
+ fn test_component_name < C : ComponentNameInterface > ( english : & str ) {
94
+ let all_handles = boot:: locate_handle_buffer ( SearchType :: AllHandles ) . unwrap ( ) ;
100
95
101
96
let fat_driver_name = cstr16 ! ( "FAT File System Driver" ) ;
102
97
let fat_controller_name = cstr16 ! ( "FAT File System" ) ;
@@ -105,7 +100,7 @@ fn test_component_name<'a, C: ComponentNameInterface<'a>>(
105
100
let component_name: C = all_handles
106
101
. iter ( )
107
102
. find_map ( |handle| {
108
- let component_name = C :: open ( boot_services , * handle) . ok ( ) ?;
103
+ let component_name = C :: open ( * handle) . ok ( ) ?;
109
104
110
105
assert ! ( component_name
111
106
. supported_languages( )
@@ -138,11 +133,11 @@ fn test_component_name<'a, C: ComponentNameInterface<'a>>(
138
133
. expect ( "failed to find FAT controller" ) ;
139
134
}
140
135
141
- pub fn test ( boot_services : & BootServices ) {
136
+ pub fn test ( ) {
142
137
info ! ( "Running component name test" ) ;
143
138
144
139
#[ allow( deprecated) ]
145
- test_component_name :: < ScopedProtocol < ComponentName1 > > ( boot_services , "eng" ) ;
146
- test_component_name :: < ScopedProtocol < ComponentName2 > > ( boot_services , "en" ) ;
147
- test_component_name :: < ComponentName > ( boot_services , "en" ) ;
140
+ test_component_name :: < ScopedProtocol < ComponentName1 > > ( "eng" ) ;
141
+ test_component_name :: < ScopedProtocol < ComponentName2 > > ( "en" ) ;
142
+ test_component_name :: < ComponentName > ( "en" ) ;
148
143
}
0 commit comments