Debian Codegraph @

/

debian rust-structmeta-derive 0.3.0-1debian librust-structmeta-derive-dev debian librust-structmeta-derive+default-dev debian librust-structmeta-derive-0-dev debian librust-structmeta-derive-0+default-dev debian librust-structmeta-derive-0.3-dev debian librust-structmeta-derive-0.3+default-dev debian librust-structmeta-derive-0.3.0-dev debian librust-structmeta-derive-0.3.0+default-dev cargo structmeta-derive 0.3.0 debianjsonmakefilemarkdownrustrust-c-abishelltoml 19 files · 519 symbols
View dependency graph

Depends on

  • dh-cargo (dh-sequence-cargo)
  • rust-proc-macro2 (librust-proc-macro2-1+default-dev)
  • rust-quote (librust-quote-1+default-dev)
  • cargo, debhelper-compat, librust-syn-2+default-dev, libstd-rust-dev, rustc
README (full)

StructMeta

Crates.io Docs.rs Actions Status

Parse Rust's attribute arguments by defining a struct.

Documentation

See #[derive(StructMeta)] documentation for details.

Install

Add this to your Cargo.toml:

[dependencies]
structmeta = "0.3.0"
proc-macro2 = "1.0.78"
syn = "2.0.48"
quote = "1.0.35"

Example

use structmeta::StructMeta;
use syn::{parse_quote, Attribute, LitInt, LitStr};

#[derive(StructMeta, Debug)]
struct MyAttr {
    x: LitInt,
    y: LitStr,
}
let attr: Attribute = parse_quote!(#[my_attr(x = 10, y = "abc")]);
let attr: MyAttr = attr.parse_args().unwrap();
println!("x = {}, y = {}", attr.x, attr.y.value());

This code outputs:

x = 10, y = abc

License

This project is dual licensed under Apache-2.0/MIT. See the two LICENSE-* files for details.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

dir debian/
dir src/
file .cargo_vcs_info.json
file Cargo.toml
file Cargo.toml.orig
file README.md