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)
3fn main() {
4 let path = env::args()
5 .nth(1)
6 .unwrap_or_else(|| "/sys/firmware/dmi/tables/DMI".to_string());
7 let data = fs::read(path).unwrap();
8 for table in dmi::tables(&data) {
9 if let Some(info) = table.get::<dmi::BiosInfo>() {
10 println!("{:?}", info);
11 } else if let Some(info) = table.get::<dmi::SystemInfo>() {
12 println!("{:?}", info);
13 } else if let Some(info) = table.get::<dmi::BaseBoardInfo>() {
14 println!("{:?}", info);
15 } else if let Some(info) = table.get::<dmi::ChassisInfo>() {
16 println!("{:?}", info);
17 } else if let Some(info) = table.get::<dmi::ProcessorInfo>() {
18 println!("{:?}", info);
19 } else if let Some(info) = table.get::<dmi::MemoryDevice>() {
20 println!("{:?}", info);
21 } else {
22 println!("Unknown table: {}", table.header.kind);
23 continue;
24 }
25 println!(" strings: {:?}", table.strings);
26 }
27}
pub fn get_str(&self, index: u8) -> Option<&String>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Table
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