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

source

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.

source

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.

source

pub fn try_load_from_file( filename: &str, version: Option<SMBiosVersion> ) -> Result<SMBiosData, Error>

Loads raw SMBios table data from a file

source

pub fn iter(&self) -> Iter<'_, UndefinedStruct>

Iterator of the contained UndefinedStruct items

source

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.

source

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.

source

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.

source

pub fn first<T>(&'a self) -> Option<T>where T: SMBiosStruct<'a>,

Finds the first occurance of the structure

source

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.

source

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.

source

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.

source

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.

source

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.

source

pub fn find_by_handle(&'a self, handle: &Handle) -> Option<&UndefinedStruct>

Finds the structure matching the given handle

source

pub fn collect<T>(&'a self) -> Vec<T>where T: SMBiosStruct<'a>,

Finds all occurances of the structure

Trait Implementations§

source§

impl Debug for SMBiosData

source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl IntoIterator for SMBiosData

§

type Item = UndefinedStruct

The type of the elements being iterated over.
§

type IntoIter = IntoIter<<SMBiosData as IntoIterator>::Item, Global>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl Serialize for SMBiosData

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.