@@ -7,7 +7,6 @@ use crate::{
7
7
EFISdt32Tag , EFISdt64Tag , ElfSectionsTag , EndTag , FramebufferTag , ImageLoadPhysAddrTag ,
8
8
MemoryMapTag , ModuleTag , RsdpV1Tag , RsdpV2Tag , SmbiosTag , TagTrait , TagType , ALIGNMENT ,
9
9
} ;
10
- use alloc:: boxed:: Box ;
11
10
use alloc:: vec:: Vec ;
12
11
use core:: fmt:: { Display , Formatter } ;
13
12
use core:: mem:: size_of;
@@ -200,32 +199,32 @@ impl InformationBuilder {
200
199
201
200
/// Adds a 'basic memory information' tag (represented by [`BasicMemoryInfoTag`]) to the builder.
202
201
#[ must_use]
203
- pub fn basic_memory_info_tag ( self , tag : BasicMemoryInfoTag ) -> Self {
204
- self . add_tag ( & tag) . unwrap ( )
202
+ pub fn basic_memory_info_tag ( self , tag : & BasicMemoryInfoTag ) -> Self {
203
+ self . add_tag ( tag) . unwrap ( )
205
204
}
206
205
207
206
/// Adds a 'bootloader name' tag (represented by [`BootLoaderNameTag`]) to the builder.
208
207
#[ must_use]
209
- pub fn bootloader_name_tag ( self , tag : Box < BootLoaderNameTag > ) -> Self {
210
- self . add_tag ( & * tag) . unwrap ( )
208
+ pub fn bootloader_name_tag ( self , tag : & BootLoaderNameTag ) -> Self {
209
+ self . add_tag ( tag) . unwrap ( )
211
210
}
212
211
213
212
/// Adds a 'command line' tag (represented by [`CommandLineTag`]) to the builder.
214
213
#[ must_use]
215
- pub fn command_line_tag ( self , tag : Box < CommandLineTag > ) -> Self {
216
- self . add_tag ( & * tag) . unwrap ( )
214
+ pub fn command_line_tag ( self , tag : & CommandLineTag ) -> Self {
215
+ self . add_tag ( tag) . unwrap ( )
217
216
}
218
217
219
218
/// Adds a 'EFI 32-bit system table pointer' tag (represented by [`EFISdt32Tag`]) to the builder.
220
219
#[ must_use]
221
- pub fn efisdt32_tag ( self , tag : EFISdt32Tag ) -> Self {
222
- self . add_tag ( & tag) . unwrap ( )
220
+ pub fn efisdt32_tag ( self , tag : & EFISdt32Tag ) -> Self {
221
+ self . add_tag ( tag) . unwrap ( )
223
222
}
224
223
225
224
/// Adds a 'EFI 64-bit system table pointer' tag (represented by [`EFISdt64Tag`]) to the builder.
226
225
#[ must_use]
227
- pub fn efisdt64_tag ( self , tag : EFISdt64Tag ) -> Self {
228
- self . add_tag ( & tag) . unwrap ( )
226
+ pub fn efisdt64_tag ( self , tag : & EFISdt64Tag ) -> Self {
227
+ self . add_tag ( tag) . unwrap ( )
229
228
}
230
229
231
230
/// Adds a 'EFI boot services not terminated' tag (represented by [`EFIBootServicesNotExitedTag`]) to the builder.
@@ -236,69 +235,69 @@ impl InformationBuilder {
236
235
237
236
/// Adds a 'EFI 32-bit image handle pointer' tag (represented by [`EFIImageHandle32Tag`]) to the builder.
238
237
#[ must_use]
239
- pub fn efi_image_handle32 ( self , tag : EFIImageHandle32Tag ) -> Self {
240
- self . add_tag ( & tag) . unwrap ( )
238
+ pub fn efi_image_handle32 ( self , tag : & EFIImageHandle32Tag ) -> Self {
239
+ self . add_tag ( tag) . unwrap ( )
241
240
}
242
241
243
242
/// Adds a 'EFI 64-bit image handle pointer' tag (represented by [`EFIImageHandle64Tag`]) to the builder.
244
243
#[ must_use]
245
- pub fn efi_image_handle64 ( self , tag : EFIImageHandle64Tag ) -> Self {
246
- self . add_tag ( & tag) . unwrap ( )
244
+ pub fn efi_image_handle64 ( self , tag : & EFIImageHandle64Tag ) -> Self {
245
+ self . add_tag ( tag) . unwrap ( )
247
246
}
248
247
249
248
/// Adds a 'EFI Memory map' tag (represented by [`EFIMemoryMapTag`]) to the builder.
250
249
#[ must_use]
251
- pub fn efi_memory_map_tag ( self , tag : Box < EFIMemoryMapTag > ) -> Self {
252
- self . add_tag ( & * tag) . unwrap ( )
250
+ pub fn efi_memory_map_tag ( self , tag : & EFIMemoryMapTag ) -> Self {
251
+ self . add_tag ( tag) . unwrap ( )
253
252
}
254
253
255
254
/// Adds a 'ELF-Symbols' tag (represented by [`ElfSectionsTag`]) to the builder.
256
255
#[ must_use]
257
- pub fn elf_sections_tag ( self , tag : Box < ElfSectionsTag > ) -> Self {
258
- self . add_tag ( & * tag) . unwrap ( )
256
+ pub fn elf_sections_tag ( self , tag : & ElfSectionsTag ) -> Self {
257
+ self . add_tag ( tag) . unwrap ( )
259
258
}
260
259
261
260
/// Adds a 'Framebuffer info' tag (represented by [`FramebufferTag`]) to the builder.
262
261
#[ must_use]
263
- pub fn framebuffer_tag ( self , tag : Box < FramebufferTag > ) -> Self {
264
- self . add_tag ( & * tag) . unwrap ( )
262
+ pub fn framebuffer_tag ( self , tag : & FramebufferTag ) -> Self {
263
+ self . add_tag ( tag) . unwrap ( )
265
264
}
266
265
267
266
/// Adds a 'Image load base physical address' tag (represented by [`ImageLoadPhysAddrTag`]) to the builder.
268
267
#[ must_use]
269
- pub fn image_load_addr ( self , tag : ImageLoadPhysAddrTag ) -> Self {
270
- self . add_tag ( & tag) . unwrap ( )
268
+ pub fn image_load_addr ( self , tag : & ImageLoadPhysAddrTag ) -> Self {
269
+ self . add_tag ( tag) . unwrap ( )
271
270
}
272
271
273
272
/// Adds a (*none EFI*) 'memory map' tag (represented by [`MemoryMapTag`]) to the builder.
274
273
#[ must_use]
275
- pub fn memory_map_tag ( self , tag : Box < MemoryMapTag > ) -> Self {
276
- self . add_tag ( & * tag) . unwrap ( )
274
+ pub fn memory_map_tag ( self , tag : & MemoryMapTag ) -> Self {
275
+ self . add_tag ( tag) . unwrap ( )
277
276
}
278
277
279
278
/// Adds a 'Modules' tag (represented by [`ModuleTag`]) to the builder.
280
279
/// This tag can occur multiple times in boot information.
281
280
#[ must_use]
282
- pub fn add_module_tag ( self , tag : Box < ModuleTag > ) -> Self {
283
- self . add_tag ( & * tag) . unwrap ( )
281
+ pub fn add_module_tag ( self , tag : & ModuleTag ) -> Self {
282
+ self . add_tag ( tag) . unwrap ( )
284
283
}
285
284
286
285
/// Adds a 'ACPI old RSDP' tag (represented by [`RsdpV1Tag`]) to the builder.
287
286
#[ must_use]
288
- pub fn rsdp_v1_tag ( self , tag : RsdpV1Tag ) -> Self {
289
- self . add_tag ( & tag) . unwrap ( )
287
+ pub fn rsdp_v1_tag ( self , tag : & RsdpV1Tag ) -> Self {
288
+ self . add_tag ( tag) . unwrap ( )
290
289
}
291
290
292
291
/// Adds a 'ACPI new RSDP' tag (represented by [`RsdpV2Tag`]) to the builder.
293
292
#[ must_use]
294
- pub fn rsdp_v2_tag ( self , tag : RsdpV2Tag ) -> Self {
295
- self . add_tag ( & tag) . unwrap ( )
293
+ pub fn rsdp_v2_tag ( self , tag : & RsdpV2Tag ) -> Self {
294
+ self . add_tag ( tag) . unwrap ( )
296
295
}
297
296
298
297
/// Adds a 'SMBIOS tables' tag (represented by [`SmbiosTag`]) to the builder.
299
298
#[ must_use]
300
- pub fn smbios_tag ( self , tag : Box < SmbiosTag > ) -> Self {
301
- self . add_tag ( & * tag) . unwrap ( )
299
+ pub fn smbios_tag ( self , tag : & SmbiosTag ) -> Self {
300
+ self . add_tag ( tag) . unwrap ( )
302
301
}
303
302
304
303
const fn tag_is_allowed_multiple_times ( tag_type : TagType ) -> bool {
@@ -322,18 +321,18 @@ mod tests {
322
321
assert_eq ! ( builder. expected_len( ) , expected_len) ;
323
322
324
323
// the most simple tag
325
- builder = builder. basic_memory_info_tag ( BasicMemoryInfoTag :: new ( 640 , 7 * 1024 ) ) ;
324
+ builder = builder. basic_memory_info_tag ( & BasicMemoryInfoTag :: new ( 640 , 7 * 1024 ) ) ;
326
325
expected_len += 16 ;
327
326
assert_eq ! ( builder. expected_len( ) , expected_len) ;
328
327
// a tag that has a dynamic size
329
- builder = builder. command_line_tag ( CommandLineTag :: new ( "test" ) ) ;
328
+ builder = builder. command_line_tag ( & CommandLineTag :: new ( "test" ) ) ;
330
329
expected_len += 8 + 5 + 3 ; // padding
331
330
assert_eq ! ( builder. expected_len( ) , expected_len) ;
332
331
// many modules
333
- builder = builder. add_module_tag ( ModuleTag :: new ( 0 , 1234 , "module1" ) ) ;
332
+ builder = builder. add_module_tag ( & ModuleTag :: new ( 0 , 1234 , "module1" ) ) ;
334
333
expected_len += 16 + 8 ;
335
334
assert_eq ! ( builder. expected_len( ) , expected_len) ;
336
- builder = builder. add_module_tag ( ModuleTag :: new ( 5678 , 6789 , "module2" ) ) ;
335
+ builder = builder. add_module_tag ( & ModuleTag :: new ( 5678 , 6789 , "module2" ) ) ;
337
336
expected_len += 16 + 8 ;
338
337
assert_eq ! ( builder. expected_len( ) , expected_len) ;
339
338
0 commit comments