pub struct SMBiosData {
pub version: Option<SMBiosVersion>,
/* private fields */
}Expand description
§SMBIOS Data
Contains an optional SMBIOS version and a collection of SMBIOS structures.
Fields§
§version: Option<SMBiosVersion>Version of the contained SMBIOS structures.
Implementations§
Source§impl<'a> SMBiosData
impl<'a> SMBiosData
Sourcepub fn new(table: UndefinedStructTable, version: Option<SMBiosVersion>) -> Self
pub fn new(table: UndefinedStructTable, version: Option<SMBiosVersion>) -> Self
Creates an SMBIOS table parser which can be iterated
table is iterable table data.
version is optional and represents the DMTF SMBIOS Standard version of the bytes in data.
Sourcepub fn from_vec_and_version(
data: Vec<u8>,
version: Option<SMBiosVersion>,
) -> Self
pub fn from_vec_and_version( data: Vec<u8>, version: Option<SMBiosVersion>, ) -> Self
Creates an SMBIOS table parser which can be iterated
data is a block of bytes representing the raw table data.
version is optional and represents the DMTF SMBIOS Standard version of the bytes in data.
Sourcepub fn try_load_from_file(
filename: &str,
version: Option<SMBiosVersion>,
) -> Result<SMBiosData, Error>
pub fn try_load_from_file( filename: &str, version: Option<SMBiosVersion>, ) -> Result<SMBiosData, Error>
Loads raw SMBios table data from a file
Sourcepub fn iter(&self) -> Iter<'_, UndefinedStruct>
pub fn iter(&self) -> Iter<'_, UndefinedStruct>
Iterator of the contained UndefinedStruct items
Sourcepub fn defined_struct_iter<T>(&'a self) -> impl Iterator<Item = T> + 'awhere
T: SMBiosStruct<'a> + 'a,
pub fn defined_struct_iter<T>(&'a self) -> impl Iterator<Item = T> + 'awhere
T: SMBiosStruct<'a> + 'a,
An iterator over the defined type instances within the table.
Sourcepub fn all<T, F>(&'a self, f: F) -> bool
pub fn all<T, F>(&'a self, f: F) -> bool
Tests if every element of the defined struct iterator matches a predicate.
Sourcepub fn any<T, F>(&'a self, f: F) -> bool
pub fn any<T, F>(&'a self, f: F) -> bool
Tests if any element of the defined struct iterator matches a predicate.
Sourcepub fn first<T>(&'a self) -> Option<T>where
T: SMBiosStruct<'a>,
pub fn first<T>(&'a self) -> Option<T>where
T: SMBiosStruct<'a>,
Finds the first occurance of the structure
Sourcepub fn find<T, P>(&'a self, predicate: P) -> Option<T>
pub fn find<T, P>(&'a self, predicate: P) -> Option<T>
Finds the first occurance of the structure that satisfies a predicate.
Sourcepub fn find_map<A, B, F>(&'a self, f: F) -> Option<B>
pub fn find_map<A, B, F>(&'a self, f: F) -> Option<B>
Applies function to the defined struct elements and returns the first non-none result.
Sourcepub fn filter<T, P>(&'a self, predicate: P) -> impl Iterator<Item = T> + 'a
pub fn filter<T, P>(&'a self, predicate: P) -> impl Iterator<Item = T> + 'a
Creates an iterator of the defined structure which uses a closure to determine if an element should be yielded.
Sourcepub fn map<A, B: 'a, F>(&'a self, f: F) -> impl Iterator<Item = B> + 'awhere
A: SMBiosStruct<'a> + 'a,
F: FnMut(A) -> B + 'a,
pub fn map<A, B: 'a, F>(&'a self, f: F) -> impl Iterator<Item = B> + 'awhere
A: SMBiosStruct<'a> + 'a,
F: FnMut(A) -> B + 'a,
Takes a closure and creates an iterator which calls that closure on each defined struct.
Sourcepub fn filter_map<A, B: 'a, F>(&'a self, f: F) -> impl Iterator<Item = B> + 'a
pub fn filter_map<A, B: 'a, F>(&'a self, f: F) -> impl Iterator<Item = B> + 'a
Creates an iterator that both filters and maps from the defined struct iterator.
Sourcepub fn find_by_handle(&'a self, handle: &Handle) -> Option<&UndefinedStruct>
pub fn find_by_handle(&'a self, handle: &Handle) -> Option<&UndefinedStruct>
Finds the structure matching the given handle
Sourcepub fn collect<T>(&'a self) -> Vec<T>where
T: SMBiosStruct<'a>,
pub fn collect<T>(&'a self) -> Vec<T>where
T: SMBiosStruct<'a>,
Finds all occurances of the structure