A Rust derive macro which permits reading struct values from a directory.
Not ready for production use, still in heavy development and many things are not yet implemented or will unexpectedly blow up.
```rust use filestruct::FromDir;
struct Files {
comm: String,
#[filestruct(file = "comm", trim = true)]
commtrimmed: String,
oomscore: u32,
doesnotexist: Option
fn main() { let files = Files::from_dir("/proc/self"); println!("{:#?}", files); } ```
Results in:
rust
Ok(
Files {
comm: "pdm-bin\n",
comm_trimmed: "pdm-bin",
oom_score: 800,
does_not_exist: None,
does_not_exist_but_renamed: Some(
200,
),
uptime: "177405.74 822813.82",
},
)
Releases are a little complicated because filestruct_derive and filestruct are
separate crates. Use cargo release
:
cargo release --execute -- minor