smbioslib/structs/types/
inactive.rs

1use crate::{SMBiosStruct, UndefinedStruct};
2use serde::{ser::SerializeStruct, Serialize, Serializer};
3use std::fmt;
4
5/// # Inactive (Type 126)
6///
7/// This structure definition supports a system implementation where the SMBIOS structure-table is a
8/// superset of all supported system attributes and provides a standard mechanism for the system BIOS to
9/// signal that a structure is currently inactive and should not be interpreted by the upper-level software.
10///
11/// Compliant with:
12/// DMTF SMBIOS Reference Specification 3.4.0 (DSP0134)
13/// Document Date: 2020-07-17
14pub struct SMBiosInactive<'a> {
15    parts: &'a UndefinedStruct,
16}
17
18impl<'a> SMBiosStruct<'a> for SMBiosInactive<'a> {
19    const STRUCT_TYPE: u8 = 126u8;
20
21    fn new(parts: &'a UndefinedStruct) -> Self {
22        Self { parts }
23    }
24
25    fn parts(&self) -> &'a UndefinedStruct {
26        self.parts
27    }
28}
29
30impl<'a> SMBiosInactive<'a> {}
31
32impl fmt::Debug for SMBiosInactive<'_> {
33    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
34        fmt.debug_struct(std::any::type_name::<SMBiosInactive<'_>>())
35            .field("header", &self.parts.header)
36            .finish()
37    }
38}
39
40impl Serialize for SMBiosInactive<'_> {
41    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
42    where
43        S: Serializer,
44    {
45        let mut state = serializer.serialize_struct("SMBiosInactive", 1)?;
46        state.serialize_field("header", &self.parts.header)?;
47        state.end()
48    }
49}