12 releases

Uses new Rust 2024

new 0.3.0 Apr 12, 2025
0.2.0 Apr 12, 2025
0.1.12 Apr 11, 2025

#159 in Command-line interface

Download history 746/week @ 2025-04-05

799 downloads per month

MIT/Apache

405KB
8K SLoC

Facet logo - a reflection library for Rust   facet-args

Coverage Status free of syn crates.io documentation MIT/Apache-2.0 licensed

Logo by Misiasart

Thanks to all individual and corporate sponsors, without whom this work could not exist:

Ko-fi GitHub Sponsors Patreon Zed built with depot

Provides CLI argument parsing (WIP).

use facet_pretty::FacetPretty;

#[test]
fn test_arg_parse() {
    use facet::Facet;

    #[derive(Facet)]
    struct Args {
        #[facet(positional)]
        path: String,

        #[facet(named, short = 'v')]
        verbose: bool,

        #[facet(named, short = 'j')]
        concurrency: usize,
    }

    let args: Args = facet_args::from_slice(&["--verbose", "--concurrency", "14", "example.rs"]);
    eprintln!("args: {}", args.pretty());
}

Dependencies

~240KB