multiboot2_header/
uefi_bs.rs1use crate::{HeaderTagFlag, HeaderTagHeader, HeaderTagType};
2use multiboot2_common::{MaybeDynSized, Tag};
3
4#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
7#[repr(C, align(8))]
8pub struct EfiBootServiceHeaderTag {
9 header: HeaderTagHeader,
10}
11
12const _: () = assert!(size_of::<EfiBootServiceHeaderTag>() == 2 + 2 + 4);
13
14impl EfiBootServiceHeaderTag {
15 #[must_use]
17 pub const fn new(flags: HeaderTagFlag) -> Self {
18 let header = HeaderTagHeader::new(HeaderTagType::EfiBS, flags, size_of::<Self>() as u32);
19 Self { header }
20 }
21
22 #[must_use]
24 pub const fn typ(&self) -> HeaderTagType {
25 self.header.typ()
26 }
27
28 #[must_use]
30 pub const fn flags(&self) -> HeaderTagFlag {
31 self.header.flags()
32 }
33
34 #[must_use]
36 pub const fn size(&self) -> u32 {
37 self.header.size()
38 }
39}
40
41unsafe impl MaybeDynSized for EfiBootServiceHeaderTag {
44 type Header = HeaderTagHeader;
45
46 const BASE_SIZE: usize = size_of::<Self>();
47}
48
49impl Tag for EfiBootServiceHeaderTag {
50 type IDType = HeaderTagType;
51 const ID: HeaderTagType = HeaderTagType::EfiBS;
52}