Struct Header

Source
pub struct Header(/* private fields */);
Expand description

§SMBIOS Header

The header part/section of a structure

Implementations§

Source§

impl Header

Source

pub const SIZE: usize = 4usize

Total size of a Header (4)

A header has a byte for the struct_type at offset 0, a byte for the length at offset 1, and a word for the handle at offset 2 for a total of 4 bytes.

Source

pub const STRUCT_TYPE_OFFSET: usize = 0usize

StructType offset (offset 0 and 1 bytes)

Source

pub const LENGTH_OFFSET: usize = 1usize

Length offset (offset 1 and 1 bytes)

Source

pub const HANDLE_OFFSET: usize = 2usize

Handle offset (offset 2 and 2 bytes)

Source

pub fn new(data: [u8; 4]) -> Self

Creates a new Header struct

Source

pub fn struct_type(&self) -> u8

The type of SMBIOS structure

Source

pub fn length(&self) -> u8

The length of the structure not including the strings part/section

Source

pub fn handle(&self) -> Handle

The handle of this structure instance

Source

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

Byte iterator of the header

Trait Implementations§

Source§

impl Debug for Header

Source§

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

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

impl Deref for Header

Source§

type Target = [u8; 4]

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl From<[u8; 4]> for Header

Source§

fn from(data: [u8; 4]) -> Self

Converts to this type from the input type.
Source§

impl Serialize for Header

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§

§

impl Freeze for Header

§

impl RefUnwindSafe for Header

§

impl Send for Header

§

impl Sync for Header

§

impl Unpin for Header

§

impl UnwindSafe for Header

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.