eminence / procfs

Rust library for reading the Linux procfs filesystem
Other
367 stars 106 forks source link

examples/mountinfo.rs panic on fs_type: "bpf", should this example skip bpf type in loop? #158

Closed eminence closed 2 years ago

eminence commented 2 years ago

Discussed in https://github.com/eminence/procfs/discussions/155

Originally posted by **pymongo** November 9, 2021 ``` [examples/mountinfo.rs:6] &mount = MountInfo { mnt_id: 33, pid: 23, majmin: "0:29", root: "/", mount_point: "/sys/fs/bpf", mount_options: { "noexec": None, "rw": None, "relatime": None, "nodev": None, "nosuid": None, }, opt_fields: [ Shared( 11, ), ], fs_type: "bpf", mount_source: None, super_options: { "rw": None, "mode": Some( "700", ), }, } thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', examples/mountinfo.rs:15:32 ```
eminence commented 2 years ago

Let's just fix the example by removing that unwrap. @pymongo do you want to make a PR for this fix?