This crate can be used to continuously scan over /proc
filesystem and store it in the struct `EncoDecode. This struct is serialized and is written to /var/log/procshot/data.
This is a wrapper over the procfs crate, so the compatibility of this crate depends on the compatibility of the procfs crate.
The stored data is of type EncoDecode
and can be read as:
Examples
use std::fs::File;
use std::io::Read;
use procshot_server::EncoDecode;
pub fn read_test_data() {
let mut file = File::open("./test_data.procshot").unwrap();
let mut data = Vec::new();
file.read_to_end(&mut data).unwrap();
let decoded: EncoDecode = bincode::deserialize(&data[..]).unwrap_or_else(|x| panic!("Error reading saved data. This was either created with an older version of procshot, or the file is corrupt. Error is {}", x));
println!("Decoded test file data: {:#?}", decoded);
}