Skip to main content

EntryPoint

Struct EntryPoint 

Source
pub struct EntryPoint<'a> { /* private fields */ }
Expand description

Unified abstraction over SMBIOS 2.1 and 3.0 entry points.

Implementations§

Source§

impl<'a> EntryPoint<'a>

Source

pub fn new(inner: EntryPointType<'a>) -> Self

Creates an EntryPoint wrapper around an already-validated entry point type.

Source

pub fn from_bytes(bytes: &'a [u8]) -> Result<Self, Status>

Attempts to parse and validate an EntryPoint from a byte slice.

Source

pub unsafe fn create(ep_start: usize) -> Result<EntryPoint<'static>, Status>

Creates an EntryPoint from a raw memory address.

§Safety

ep_start must point to valid mapped memory containing at least size_of::<EntryPoint2_1>() (0x1f) bytes or size_of::<EntryPoint3_0>() (0x18) bytes.

Source

pub fn struct_table_phys(&self) -> u64

Returns the physical address of the structure table.

Source

pub fn struct_table_length(&self) -> u32

Returns the length of the structure table in bytes.

Note that for SMBIOS 3.0, this returns max_struct_size, and the structures should be checked for the End-of-Table type (StructType::END_OF_TABLE).

Source

pub fn max_struct_size(&self) -> u32

Returns the maximum structure size in bytes.

Source

pub fn version(&self) -> SpecVersion

Returns the specification version supported by this entry point.

Source

pub fn has_struct_count(&self) -> bool

Returns true if the entry point specifies a structure count (SMBIOS 2.1).

Source

pub fn struct_count(&self) -> u16

Returns the number of structures (SMBIOS 2.1 only).

§Panics

Panics if called on an SMBIOS 3.0 entry point where structure count is not present.

Source

pub fn walk_structs<F>(&self, struct_table: &[u8], cb: F) -> Result<(), Status>
where F: FnMut(SpecVersion, &Header, &StringTable<'_>) -> Result<(), Status>,

Walks the known SMBIOS structures within the provided struct_table slice. The callback will be called once for each structure found.

Return values from the callback:

  • Err(Status::STOP): aborted and returns Ok(())
  • Ok(()) or Err(Status::NEXT): walk continues to the next structure
  • Any other error: walk is aborted and returns the error
Source

pub unsafe fn walk_structs_raw<F>( &self, struct_table_virt: usize, cb: F, ) -> Result<(), Status>
where F: FnMut(SpecVersion, &Header, &StringTable<'_>) -> Result<(), Status>,

Walks the known SMBIOS structures mapped at virtual address struct_table_virt.

§Safety

struct_table_virt must point to valid mapped memory containing at least struct_table_length() bytes.

Trait Implementations§

Source§

impl<'a> Clone for EntryPoint<'a>

Source§

fn clone(&self) -> EntryPoint<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable)§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for EntryPoint<'a>

Source§

impl<'a> Debug for EntryPoint<'a>

Source§

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

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

impl<'a> From<&'a EntryPoint2_1> for EntryPoint<'a>

Source§

fn from(ep: &'a EntryPoint2_1) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a EntryPoint3_0> for EntryPoint<'a>

Source§

fn from(ep: &'a EntryPoint3_0) -> Self

Converts to this type from the input type.
Source§

impl<'a> PartialEq for EntryPoint<'a>

Source§

fn eq(&self, other: &EntryPoint<'a>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable)§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'a> StructuralPartialEq for EntryPoint<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for EntryPoint<'a>

§

impl<'a> RefUnwindSafe for EntryPoint<'a>

§

impl<'a> Send for EntryPoint<'a>

§

impl<'a> Sync for EntryPoint<'a>

§

impl<'a> Unpin for EntryPoint<'a>

§

impl<'a> UnsafeUnpin for EntryPoint<'a>

§

impl<'a> UnwindSafe for EntryPoint<'a>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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> ToMutPtr for T
where T: ?Sized,

Source§

type Target = T

The target type of the pointer.
Source§

fn to_mut_ptr(&self) -> *mut T

Casts the reference to a mutable raw pointer.
§

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

§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.