pub struct Table {
pub header: Header,
pub data: Vec<u8>,
pub strings: Vec<String>,
}
Fields§
§header: Header
§data: Vec<u8>
§strings: Vec<String>
Implementations§
source§impl Table
impl Table
sourcepub fn get<T: TableKind>(&self) -> Option<&T>
pub fn get<T: TableKind>(&self) -> Option<&T>
Examples found in repository?
examples/print.rs (line 9)
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
fn main() {
let path = env::args()
.nth(1)
.unwrap_or_else(|| "/sys/firmware/dmi/tables/DMI".to_string());
let data = fs::read(path).unwrap();
for table in dmi::tables(&data) {
if let Some(info) = table.get::<dmi::BiosInfo>() {
println!("{:?}", info);
} else if let Some(info) = table.get::<dmi::SystemInfo>() {
println!("{:?}", info);
} else if let Some(info) = table.get::<dmi::BaseBoardInfo>() {
println!("{:?}", info);
} else if let Some(info) = table.get::<dmi::ChassisInfo>() {
println!("{:?}", info);
} else if let Some(info) = table.get::<dmi::ProcessorInfo>() {
println!("{:?}", info);
} else if let Some(info) = table.get::<dmi::MemoryDevice>() {
println!("{:?}", info);
} else {
println!("Unknown table: {}", table.header.kind);
continue;
}
println!(" strings: {:?}", table.strings);
}
}
pub fn get_str(&self, index: u8) -> Option<&String>
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Table
impl Send for Table
impl Sync for Table
impl Unpin for Table
impl UnwindSafe for Table
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more