@@ -287,72 +287,126 @@ impl InformationBuilder {
287
287
Self :: build_add_bytes ( bytes, & EndTag :: default ( ) . struct_as_bytes ( ) , true ) ;
288
288
}
289
289
290
- pub fn basic_memory_info_tag ( & mut self , basic_memory_info_tag : BasicMemoryInfoTag ) {
291
- self . basic_memory_info_tag = Some ( basic_memory_info_tag)
290
+ /// Adds a 'basic memory information' tag (represented by [`BasicMemoryInfoTag`]) to the builder to later build the
291
+ /// boot information from.
292
+ pub fn basic_memory_info_tag ( mut self , basic_memory_info_tag : BasicMemoryInfoTag ) -> Self {
293
+ self . basic_memory_info_tag = Some ( basic_memory_info_tag) ;
294
+ self
292
295
}
293
296
294
- pub fn bootloader_name_tag ( & mut self , boot_loader_name_tag : BoxedDst < BootLoaderNameTag > ) {
297
+ /// Adds a 'bootloader name' tag (represented by [`BootLoaderNameTag`]) to the builder to later build the
298
+ /// boot information from.
299
+ pub fn bootloader_name_tag (
300
+ mut self ,
301
+ boot_loader_name_tag : BoxedDst < BootLoaderNameTag > ,
302
+ ) -> Self {
295
303
self . boot_loader_name_tag = Some ( boot_loader_name_tag) ;
304
+ self
296
305
}
297
306
298
- pub fn command_line_tag ( & mut self , command_line_tag : BoxedDst < CommandLineTag > ) {
307
+ /// Adds a 'command line' tag (represented by [`CommandLineTag`]) to the builder to later build the
308
+ /// boot information from.
309
+ pub fn command_line_tag ( mut self , command_line_tag : BoxedDst < CommandLineTag > ) -> Self {
299
310
self . command_line_tag = Some ( command_line_tag) ;
311
+ self
300
312
}
301
313
302
- pub fn efisdt32_tag ( & mut self , efisdt32 : EFISdt32Tag ) {
314
+ /// Adds a 'EFI 32-bit system table pointer' tag (represented by [`EFISdt32Tag`]) to the builder to later build the
315
+ /// boot information from.
316
+ pub fn efisdt32_tag ( mut self , efisdt32 : EFISdt32Tag ) -> Self {
303
317
self . efisdt32_tag = Some ( efisdt32) ;
318
+ self
304
319
}
305
320
306
- pub fn efisdt64_tag ( & mut self , efisdt64 : EFISdt64Tag ) {
321
+ /// Adds a 'EFI 64-bit system table pointer' tag (represented by [`EFISdt64Tag`]) to the builder to later build the
322
+ /// boot information from.
323
+ pub fn efisdt64_tag ( mut self , efisdt64 : EFISdt64Tag ) -> Self {
307
324
self . efisdt64_tag = Some ( efisdt64) ;
325
+ self
308
326
}
309
327
310
- pub fn efi_boot_services_not_exited_tag ( & mut self ) {
328
+ /// Adds a 'EFI boot services not terminated' tag (represented by [`EFIBootServicesNotExitedTag`]) to the builder
329
+ /// to later build the boot information from.
330
+ pub fn efi_boot_services_not_exited_tag ( mut self ) -> Self {
311
331
self . efi_boot_services_not_exited_tag = Some ( EFIBootServicesNotExitedTag :: new ( ) ) ;
332
+ self
312
333
}
313
334
314
- pub fn efi_image_handle32 ( & mut self , efi_image_handle32 : EFIImageHandle32Tag ) {
335
+ /// Adds a 'EFI 32-bit image handle pointer' tag (represented by [`EFIImageHandle32Tag`]) to the builder
336
+ /// to later build the boot information from.
337
+ pub fn efi_image_handle32 ( mut self , efi_image_handle32 : EFIImageHandle32Tag ) -> Self {
315
338
self . efi_image_handle32 = Some ( efi_image_handle32) ;
339
+ self
316
340
}
317
341
318
- pub fn efi_image_handle64 ( & mut self , efi_image_handle64 : EFIImageHandle64Tag ) {
342
+ /// Adds a 'EFI 64-bit image handle pointer' tag (represented by [`EFIImageHandle64Tag`]) to the builder
343
+ /// to later build the boot information from.
344
+ pub fn efi_image_handle64 ( mut self , efi_image_handle64 : EFIImageHandle64Tag ) -> Self {
319
345
self . efi_image_handle64 = Some ( efi_image_handle64) ;
346
+ self
320
347
}
321
348
322
- pub fn efi_memory_map_tag ( & mut self , efi_memory_map_tag : BoxedDst < EFIMemoryMapTag > ) {
349
+ /// Adds a 'EFI Memory map' tag (represented by [`EFIMemoryMapTag`]) to the builder
350
+ /// to later build the boot information from.
351
+ pub fn efi_memory_map_tag ( mut self , efi_memory_map_tag : BoxedDst < EFIMemoryMapTag > ) -> Self {
323
352
self . efi_memory_map_tag = Some ( efi_memory_map_tag) ;
353
+ self
324
354
}
325
355
326
- pub fn elf_sections_tag ( & mut self , elf_sections_tag : BoxedDst < ElfSectionsTag > ) {
356
+ /// Adds a 'ELF-Symbols' tag (represented by [`ElfSectionsTag`]) to the builder
357
+ /// to later build the boot information from.
358
+ pub fn elf_sections_tag ( mut self , elf_sections_tag : BoxedDst < ElfSectionsTag > ) -> Self {
327
359
self . elf_sections_tag = Some ( elf_sections_tag) ;
360
+ self
328
361
}
329
362
330
- pub fn framebuffer_tag ( & mut self , framebuffer_tag : BoxedDst < FramebufferTag > ) {
363
+ /// Adds a 'Framebuffer info' tag (represented by [`FramebufferTag`]) to the builder
364
+ /// to later build the boot information from.
365
+ pub fn framebuffer_tag ( mut self , framebuffer_tag : BoxedDst < FramebufferTag > ) -> Self {
331
366
self . framebuffer_tag = Some ( framebuffer_tag) ;
367
+ self
332
368
}
333
369
334
- pub fn image_load_addr ( & mut self , image_load_addr : ImageLoadPhysAddrTag ) {
370
+ /// Adds a 'Image load base physical address' tag (represented by [`ImageLoadPhysAddrTag`]) to the builder
371
+ /// to later build the boot information from.
372
+ pub fn image_load_addr ( mut self , image_load_addr : ImageLoadPhysAddrTag ) -> Self {
335
373
self . image_load_addr = Some ( image_load_addr) ;
374
+ self
336
375
}
337
376
338
- pub fn memory_map_tag ( & mut self , memory_map_tag : BoxedDst < MemoryMapTag > ) {
377
+ /// Adds a (*none EFI*) 'memory map' tag (represented by [`MemoryMapTag`]) to the builder
378
+ /// to later build the boot information from.
379
+ pub fn memory_map_tag ( mut self , memory_map_tag : BoxedDst < MemoryMapTag > ) -> Self {
339
380
self . memory_map_tag = Some ( memory_map_tag) ;
381
+ self
340
382
}
341
383
342
- pub fn add_module_tag ( & mut self , module_tag : BoxedDst < ModuleTag > ) {
384
+ /// Adds a 'Modules' tag (represented by [`ModuleTag`]) to the builder
385
+ /// to later build the boot information from. This tag can occur multiple times in boot information.
386
+ pub fn add_module_tag ( mut self , module_tag : BoxedDst < ModuleTag > ) -> Self {
343
387
self . module_tags . push ( module_tag) ;
388
+ self
344
389
}
345
390
346
- pub fn rsdp_v1_tag ( & mut self , rsdp_v1_tag : RsdpV1Tag ) {
391
+ /// Adds a 'ACPI old RSDP' tag (represented by [`RsdpV1Tag`]) to the builder
392
+ /// to later build the boot information from.
393
+ pub fn rsdp_v1_tag ( mut self , rsdp_v1_tag : RsdpV1Tag ) -> Self {
347
394
self . rsdp_v1_tag = Some ( rsdp_v1_tag) ;
395
+ self
348
396
}
349
397
350
- pub fn rsdp_v2_tag ( & mut self , rsdp_v2_tag : RsdpV2Tag ) {
398
+ /// Adds a 'ACPI new RSDP' tag (represented by [`RsdpV2Tag`]) to the builder
399
+ /// to later build the boot information from.
400
+ pub fn rsdp_v2_tag ( mut self , rsdp_v2_tag : RsdpV2Tag ) -> Self {
351
401
self . rsdp_v2_tag = Some ( rsdp_v2_tag) ;
402
+ self
352
403
}
353
404
354
- pub fn add_smbios_tag ( & mut self , smbios_tag : BoxedDst < SmbiosTag > ) {
405
+ /// Adds a 'SMBIOS tables' tag (represented by [`SmbiosTag`]) to the builder
406
+ /// to later build the boot information from.
407
+ pub fn add_smbios_tag ( mut self , smbios_tag : BoxedDst < SmbiosTag > ) -> Self {
355
408
self . smbios_tags . push ( smbios_tag) ;
409
+ self
356
410
}
357
411
}
358
412
@@ -369,18 +423,18 @@ mod tests {
369
423
assert_eq ! ( builder. expected_len( ) , expected_len) ;
370
424
371
425
// the most simple tag
372
- builder. basic_memory_info_tag ( BasicMemoryInfoTag :: new ( 640 , 7 * 1024 ) ) ;
426
+ builder = builder . basic_memory_info_tag ( BasicMemoryInfoTag :: new ( 640 , 7 * 1024 ) ) ;
373
427
expected_len += 16 ;
374
428
assert_eq ! ( builder. expected_len( ) , expected_len) ;
375
429
// a tag that has a dynamic size
376
- builder. command_line_tag ( CommandLineTag :: new ( "test" ) ) ;
430
+ builder = builder . command_line_tag ( CommandLineTag :: new ( "test" ) ) ;
377
431
expected_len += 8 + 5 + 3 ; // padding
378
432
assert_eq ! ( builder. expected_len( ) , expected_len) ;
379
433
// many modules
380
- builder. add_module_tag ( ModuleTag :: new ( 0 , 1234 , "module1" ) ) ;
434
+ builder = builder . add_module_tag ( ModuleTag :: new ( 0 , 1234 , "module1" ) ) ;
381
435
expected_len += 16 + 8 ;
382
436
assert_eq ! ( builder. expected_len( ) , expected_len) ;
383
- builder. add_module_tag ( ModuleTag :: new ( 5678 , 6789 , "module2" ) ) ;
437
+ builder = builder . add_module_tag ( ModuleTag :: new ( 5678 , 6789 , "module2" ) ) ;
384
438
expected_len += 16 + 8 ;
385
439
assert_eq ! ( builder. expected_len( ) , expected_len) ;
386
440
0 commit comments