structfromdir 0.1.0

Derive macro to read from a directory into a Rust struct
Documentation
  • Coverage
  • 0%
    0 out of 2 items documented0 out of 1 items with examples
  • Size
  • Source code size: 5.72 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 269.51 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 4s Average build duration of successful builds.
  • all releases: 4s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • cdown/filestruct
    2 1 10
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • cdown

structfromdir

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.

Usage

use structfromdir::FromDir;

#[derive(FromDir, Debug)]
struct Files {
    capacity: u8,
    energy_now: u64,
}

fn main() {
    let files = Files::from_dir("/sys/class/power_supply/BAT0");
    println!("{:?}", files);
}

Results in:

Ok(Files { capacity: 68, energy_now: 38780000 })