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>
impl<'a> EntryPoint<'a>
Sourcepub fn new(inner: EntryPointType<'a>) -> Self
pub fn new(inner: EntryPointType<'a>) -> Self
Creates an EntryPoint wrapper around an already-validated entry point type.
Sourcepub fn from_bytes(bytes: &'a [u8]) -> Result<Self, Status>
pub fn from_bytes(bytes: &'a [u8]) -> Result<Self, Status>
Attempts to parse and validate an EntryPoint from a byte slice.
Sourcepub unsafe fn create(ep_start: usize) -> Result<EntryPoint<'static>, Status>
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.
Sourcepub fn struct_table_phys(&self) -> u64
pub fn struct_table_phys(&self) -> u64
Returns the physical address of the structure table.
Sourcepub fn struct_table_length(&self) -> u32
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).
Sourcepub fn max_struct_size(&self) -> u32
pub fn max_struct_size(&self) -> u32
Returns the maximum structure size in bytes.
Sourcepub fn version(&self) -> SpecVersion
pub fn version(&self) -> SpecVersion
Returns the specification version supported by this entry point.
Sourcepub fn has_struct_count(&self) -> bool
pub fn has_struct_count(&self) -> bool
Returns true if the entry point specifies a structure count (SMBIOS 2.1).
Sourcepub fn struct_count(&self) -> u16
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.
Sourcepub fn walk_structs<F>(&self, struct_table: &[u8], cb: F) -> Result<(), Status>
pub fn walk_structs<F>(&self, struct_table: &[u8], cb: F) -> 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 returnsOk(())Ok(())orErr(Status::NEXT): walk continues to the next structure- Any other error: walk is aborted and returns the error
Sourcepub unsafe fn walk_structs_raw<F>(
&self,
struct_table_virt: usize,
cb: F,
) -> Result<(), Status>
pub unsafe fn walk_structs_raw<F>( &self, struct_table_virt: usize, cb: F, ) -> 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>
impl<'a> Clone for EntryPoint<'a>
Source§fn clone(&self) -> EntryPoint<'a>
fn clone(&self) -> EntryPoint<'a>
1.0.0 (const: unstable)§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<'a> Copy for EntryPoint<'a>
Source§impl<'a> Debug for EntryPoint<'a>
impl<'a> Debug for EntryPoint<'a>
Source§impl<'a> From<&'a EntryPoint2_1> for EntryPoint<'a>
impl<'a> From<&'a EntryPoint2_1> for EntryPoint<'a>
Source§fn from(ep: &'a EntryPoint2_1) -> Self
fn from(ep: &'a EntryPoint2_1) -> Self
Source§impl<'a> From<&'a EntryPoint3_0> for EntryPoint<'a>
impl<'a> From<&'a EntryPoint3_0> for EntryPoint<'a>
Source§fn from(ep: &'a EntryPoint3_0) -> Self
fn from(ep: &'a EntryPoint3_0) -> Self
Source§impl<'a> PartialEq for EntryPoint<'a>
impl<'a> PartialEq for EntryPoint<'a>
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 Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)