pub struct RawStructure<'buffer> {
pub version: SmbiosVersion,
pub info: InfoType,
pub length: u8,
pub handle: u16,
pub data: &'buffer [u8],
/* private fields */
}Expand description
The raw SMBIOS structure information for structures that are not handled by this crate, such as Oem structures.
Fields§
§version: SmbiosVersion§info: InfoType§length: u8§handle: u16§data: &'buffer [u8]Implementations§
Source§impl<'buffer> RawStructure<'buffer>
impl<'buffer> RawStructure<'buffer>
Sourcepub fn find_string(
&self,
idx: u8,
) -> Result<&'buffer str, MalformedStructureError>
pub fn find_string( &self, idx: u8, ) -> Result<&'buffer str, MalformedStructureError>
Find a string in the strings table by the string index. If the string index is 0, the empty string is returned. Otherwise, the string corresponding to that string index in the strings table is returned.
§Errors
Returns a MalformedStructureError::InvalidStringIndex if the index is outside of the strings table.
Sourcepub fn get<T: TryFromBytes<'buffer, T>>(
&self,
offset: usize,
) -> Result<T, MalformedStructureError>
pub fn get<T: TryFromBytes<'buffer, T>>( &self, offset: usize, ) -> Result<T, MalformedStructureError>
Get value by offset declared in SMBIOS Reference Specification.
Type meaning data length is mandatory:
- BYTE: u8
- WORD: u16
- DWORD: u32
- QWORD: u64
The only error this method returned: MalformedStructureError::InvalidSlice (actually is core::array::TryFromSliceError). If getting value index exceedes length of Formatted section it may be ignored to return None value of structure field. In this case Formatted section length automatically hide non-existing values
Sourcepub fn get_slice(&self, offset: usize, size: usize) -> Option<&'buffer [u8]>
pub fn get_slice(&self, offset: usize, size: usize) -> Option<&'buffer [u8]>
Wrapper to self.data.get(..) with header offset correction
Sourcepub fn get_string(
&self,
offset: usize,
) -> Result<&'buffer str, MalformedStructureError>
pub fn get_string( &self, offset: usize, ) -> Result<&'buffer str, MalformedStructureError>
Get STRING by offset declared in SMBIOS Reference Specification
Trait Implementations§
Source§impl<'buffer> Clone for RawStructure<'buffer>
impl<'buffer> Clone for RawStructure<'buffer>
Source§fn clone(&self) -> RawStructure<'buffer>
fn clone(&self) -> RawStructure<'buffer>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more