Struct smbioslib::SMBiosData
source · 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) -> boolwhere
T: SMBiosStruct<'a>,
F: FnMut(T) -> bool,
pub fn all<T, F>(&'a self, f: F) -> boolwhere T: SMBiosStruct<'a>, F: FnMut(T) -> bool,
Tests if every element of the defined struct iterator matches a predicate.
sourcepub fn any<T, F>(&'a self, f: F) -> boolwhere
T: SMBiosStruct<'a>,
F: FnMut(T) -> bool,
pub fn any<T, F>(&'a self, f: F) -> boolwhere T: SMBiosStruct<'a>, F: FnMut(T) -> 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>where
T: SMBiosStruct<'a>,
P: FnMut(&T) -> bool,
pub fn find<T, P>(&'a self, predicate: P) -> Option<T>where T: SMBiosStruct<'a>, P: FnMut(&T) -> bool,
Finds the first occurance of the structure that satisfies a predicate.
sourcepub fn find_map<A, B, F>(&'a self, f: F) -> Option<B>where
A: SMBiosStruct<'a>,
F: FnMut(A) -> Option<B>,
pub fn find_map<A, B, F>(&'a self, f: F) -> Option<B>where A: SMBiosStruct<'a>, F: FnMut(A) -> 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> + 'awhere
T: SMBiosStruct<'a> + 'a,
P: FnMut(&T) -> bool + 'a,
pub fn filter<T, P>(&'a self, predicate: P) -> impl Iterator<Item = T> + 'awhere T: SMBiosStruct<'a> + 'a, P: FnMut(&T) -> bool + '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> + 'awhere
A: SMBiosStruct<'a> + 'a,
F: FnMut(A) -> Option<B> + 'a,
pub fn filter_map<A, B: 'a, F>(&'a self, f: F) -> impl Iterator<Item = B> + 'awhere A: SMBiosStruct<'a> + 'a, F: FnMut(A) -> Option<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