@@ -287,72 +287,110 @@ impl InformationBuilder {
287287 Self :: build_add_bytes ( bytes, & EndTag :: default ( ) . struct_as_bytes ( ) , true ) ;
288288 }
289289
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.
291+ pub fn basic_memory_info_tag ( mut self , basic_memory_info_tag : BasicMemoryInfoTag ) -> Self {
292+ self . basic_memory_info_tag = Some ( basic_memory_info_tag) ;
293+ self
292294 }
293295
294- pub fn bootloader_name_tag ( & mut self , boot_loader_name_tag : BoxedDst < BootLoaderNameTag > ) {
296+ /// Adds a 'bootloader name' tag (represented by [`BootLoaderNameTag`]) to the builder.
297+ pub fn bootloader_name_tag (
298+ mut self ,
299+ boot_loader_name_tag : BoxedDst < BootLoaderNameTag > ,
300+ ) -> Self {
295301 self . boot_loader_name_tag = Some ( boot_loader_name_tag) ;
302+ self
296303 }
297304
298- pub fn command_line_tag ( & mut self , command_line_tag : BoxedDst < CommandLineTag > ) {
305+ /// Adds a 'command line' tag (represented by [`CommandLineTag`]) to the builder.
306+ pub fn command_line_tag ( mut self , command_line_tag : BoxedDst < CommandLineTag > ) -> Self {
299307 self . command_line_tag = Some ( command_line_tag) ;
308+ self
300309 }
301310
302- pub fn efisdt32_tag ( & mut self , efisdt32 : EFISdt32Tag ) {
311+ /// Adds a 'EFI 32-bit system table pointer' tag (represented by [`EFISdt32Tag`]) to the builder.
312+ pub fn efisdt32_tag ( mut self , efisdt32 : EFISdt32Tag ) -> Self {
303313 self . efisdt32_tag = Some ( efisdt32) ;
314+ self
304315 }
305316
306- pub fn efisdt64_tag ( & mut self , efisdt64 : EFISdt64Tag ) {
317+ /// Adds a 'EFI 64-bit system table pointer' tag (represented by [`EFISdt64Tag`]) to the builder.
318+ pub fn efisdt64_tag ( mut self , efisdt64 : EFISdt64Tag ) -> Self {
307319 self . efisdt64_tag = Some ( efisdt64) ;
320+ self
308321 }
309322
310- pub fn efi_boot_services_not_exited_tag ( & mut self ) {
323+ /// Adds a 'EFI boot services not terminated' tag (represented by [`EFIBootServicesNotExitedTag`]) to the builder.
324+ pub fn efi_boot_services_not_exited_tag ( mut self ) -> Self {
311325 self . efi_boot_services_not_exited_tag = Some ( EFIBootServicesNotExitedTag :: new ( ) ) ;
326+ self
312327 }
313328
314- pub fn efi_image_handle32 ( & mut self , efi_image_handle32 : EFIImageHandle32Tag ) {
329+ /// Adds a 'EFI 32-bit image handle pointer' tag (represented by [`EFIImageHandle32Tag`]) to the builder.
330+ pub fn efi_image_handle32 ( mut self , efi_image_handle32 : EFIImageHandle32Tag ) -> Self {
315331 self . efi_image_handle32 = Some ( efi_image_handle32) ;
332+ self
316333 }
317334
318- pub fn efi_image_handle64 ( & mut self , efi_image_handle64 : EFIImageHandle64Tag ) {
335+ /// Adds a 'EFI 64-bit image handle pointer' tag (represented by [`EFIImageHandle64Tag`]) to the builder.
336+ pub fn efi_image_handle64 ( mut self , efi_image_handle64 : EFIImageHandle64Tag ) -> Self {
319337 self . efi_image_handle64 = Some ( efi_image_handle64) ;
338+ self
320339 }
321340
322- pub fn efi_memory_map_tag ( & mut self , efi_memory_map_tag : BoxedDst < EFIMemoryMapTag > ) {
341+ /// Adds a 'EFI Memory map' tag (represented by [`EFIMemoryMapTag`]) to the builder.
342+ pub fn efi_memory_map_tag ( mut self , efi_memory_map_tag : BoxedDst < EFIMemoryMapTag > ) -> Self {
323343 self . efi_memory_map_tag = Some ( efi_memory_map_tag) ;
344+ self
324345 }
325346
326- pub fn elf_sections_tag ( & mut self , elf_sections_tag : BoxedDst < ElfSectionsTag > ) {
347+ /// Adds a 'ELF-Symbols' tag (represented by [`ElfSectionsTag`]) to the builder.
348+ pub fn elf_sections_tag ( mut self , elf_sections_tag : BoxedDst < ElfSectionsTag > ) -> Self {
327349 self . elf_sections_tag = Some ( elf_sections_tag) ;
350+ self
328351 }
329352
330- pub fn framebuffer_tag ( & mut self , framebuffer_tag : BoxedDst < FramebufferTag > ) {
353+ /// Adds a 'Framebuffer info' tag (represented by [`FramebufferTag`]) to the builder.
354+ pub fn framebuffer_tag ( mut self , framebuffer_tag : BoxedDst < FramebufferTag > ) -> Self {
331355 self . framebuffer_tag = Some ( framebuffer_tag) ;
356+ self
332357 }
333358
334- pub fn image_load_addr ( & mut self , image_load_addr : ImageLoadPhysAddrTag ) {
359+ /// Adds a 'Image load base physical address' tag (represented by [`ImageLoadPhysAddrTag`]) to the builder.
360+ pub fn image_load_addr ( mut self , image_load_addr : ImageLoadPhysAddrTag ) -> Self {
335361 self . image_load_addr = Some ( image_load_addr) ;
362+ self
336363 }
337364
338- pub fn memory_map_tag ( & mut self , memory_map_tag : BoxedDst < MemoryMapTag > ) {
365+ /// Adds a (*none EFI*) 'memory map' tag (represented by [`MemoryMapTag`]) to the builder.
366+ pub fn memory_map_tag ( mut self , memory_map_tag : BoxedDst < MemoryMapTag > ) -> Self {
339367 self . memory_map_tag = Some ( memory_map_tag) ;
368+ self
340369 }
341370
342- pub fn add_module_tag ( & mut self , module_tag : BoxedDst < ModuleTag > ) {
371+ /// Adds a 'Modules' tag (represented by [`ModuleTag`]) to the builder.
372+ /// This tag can occur multiple times in boot information.
373+ pub fn add_module_tag ( mut self , module_tag : BoxedDst < ModuleTag > ) -> Self {
343374 self . module_tags . push ( module_tag) ;
375+ self
344376 }
345377
346- pub fn rsdp_v1_tag ( & mut self , rsdp_v1_tag : RsdpV1Tag ) {
378+ /// Adds a 'ACPI old RSDP' tag (represented by [`RsdpV1Tag`]) to the builder.
379+ pub fn rsdp_v1_tag ( mut self , rsdp_v1_tag : RsdpV1Tag ) -> Self {
347380 self . rsdp_v1_tag = Some ( rsdp_v1_tag) ;
381+ self
348382 }
349383
350- pub fn rsdp_v2_tag ( & mut self , rsdp_v2_tag : RsdpV2Tag ) {
384+ /// Adds a 'ACPI new RSDP' tag (represented by [`RsdpV2Tag`]) to the builder.
385+ pub fn rsdp_v2_tag ( mut self , rsdp_v2_tag : RsdpV2Tag ) -> Self {
351386 self . rsdp_v2_tag = Some ( rsdp_v2_tag) ;
387+ self
352388 }
353389
354- pub fn add_smbios_tag ( & mut self , smbios_tag : BoxedDst < SmbiosTag > ) {
390+ /// Adds a 'SMBIOS tables' tag (represented by [`SmbiosTag`]) to the builder.
391+ pub fn add_smbios_tag ( mut self , smbios_tag : BoxedDst < SmbiosTag > ) -> Self {
355392 self . smbios_tags . push ( smbios_tag) ;
393+ self
356394 }
357395}
358396
@@ -369,18 +407,18 @@ mod tests {
369407 assert_eq ! ( builder. expected_len( ) , expected_len) ;
370408
371409 // the most simple tag
372- builder. basic_memory_info_tag ( BasicMemoryInfoTag :: new ( 640 , 7 * 1024 ) ) ;
410+ builder = builder . basic_memory_info_tag ( BasicMemoryInfoTag :: new ( 640 , 7 * 1024 ) ) ;
373411 expected_len += 16 ;
374412 assert_eq ! ( builder. expected_len( ) , expected_len) ;
375413 // a tag that has a dynamic size
376- builder. command_line_tag ( CommandLineTag :: new ( "test" ) ) ;
414+ builder = builder . command_line_tag ( CommandLineTag :: new ( "test" ) ) ;
377415 expected_len += 8 + 5 + 3 ; // padding
378416 assert_eq ! ( builder. expected_len( ) , expected_len) ;
379417 // many modules
380- builder. add_module_tag ( ModuleTag :: new ( 0 , 1234 , "module1" ) ) ;
418+ builder = builder . add_module_tag ( ModuleTag :: new ( 0 , 1234 , "module1" ) ) ;
381419 expected_len += 16 + 8 ;
382420 assert_eq ! ( builder. expected_len( ) , expected_len) ;
383- builder. add_module_tag ( ModuleTag :: new ( 5678 , 6789 , "module2" ) ) ;
421+ builder = builder . add_module_tag ( ModuleTag :: new ( 5678 , 6789 , "module2" ) ) ;
384422 expected_len += 16 + 8 ;
385423 assert_eq ! ( builder. expected_len( ) , expected_len) ;
386424
0 commit comments