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
sourceimpl<'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>(&'a self) -> impl Iterator<Item = T> + 'a where
T: SMBiosStruct<'a>,
pub fn defined_struct_iter<T: 'a>(&'a self) -> impl Iterator<Item = T> + 'a where
T: SMBiosStruct<'a>,
An iterator over the defined type instances within the table.
sourcepub fn all<T, F>(&'a self, f: F) -> bool where
T: SMBiosStruct<'a>,
F: FnMut(T) -> bool,
pub fn all<T, F>(&'a self, f: F) -> bool where
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) -> bool where
T: SMBiosStruct<'a>,
F: FnMut(T) -> bool,
pub fn any<T, F>(&'a self, f: F) -> bool where
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: 'a, P: 'a>(
&'a self,
predicate: P
) -> impl Iterator<Item = T> + 'a where
T: SMBiosStruct<'a>,
P: FnMut(&T) -> bool,
pub fn filter<T: 'a, P: 'a>(
&'a self,
predicate: P
) -> impl Iterator<Item = T> + 'a where
T: SMBiosStruct<'a>,
P: FnMut(&T) -> bool,
Creates an iterator of the defined structure which uses a closure to determine if an element should be yielded.
sourcepub fn map<A: 'a, B: 'a, F: 'a>(&'a self, f: F) -> impl Iterator<Item = B> + 'a where
A: SMBiosStruct<'a>,
F: FnMut(A) -> B,
pub fn map<A: 'a, B: 'a, F: 'a>(&'a self, f: F) -> impl Iterator<Item = B> + 'a where
A: SMBiosStruct<'a>,
F: FnMut(A) -> B,
Takes a closure and creates an iterator which calls that closure on each defined struct.
sourcepub fn filter_map<A: 'a, B: 'a, F: 'a>(
&'a self,
f: F
) -> impl Iterator<Item = B> + 'a where
A: SMBiosStruct<'a>,
F: FnMut(A) -> Option<B>,
pub fn filter_map<A: 'a, B: 'a, F: 'a>(
&'a self,
f: F
) -> impl Iterator<Item = B> + 'a where
A: SMBiosStruct<'a>,
F: FnMut(A) -> Option<B>,
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
Trait Implementations
sourceimpl Debug for SMBiosData
impl Debug for SMBiosData
sourceimpl IntoIterator for SMBiosData
impl IntoIterator for SMBiosData
sourceimpl Serialize for SMBiosData
impl Serialize for SMBiosData
Auto Trait Implementations
impl RefUnwindSafe for SMBiosData
impl Send for SMBiosData
impl Sync for SMBiosData
impl Unpin for SMBiosData
impl UnwindSafe for SMBiosData
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more