Registry / other / synstructure

synstructure

JSON →
library0.13.2rscratesunverified

Helper methods and macros for custom derives

# Cargo.toml [dependencies] synstructure = "0.13.2"
INSTALL
IMPORT
SIG · SYNSTRUCTURE
S
synstructure
otherrustv0.13.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

decl_derive
use synstructure::decl_derive;

Declare a custom derive macro using synstructure

use synstructure::decl_derive; decl_derive!([MyDerive] => my_derive); fn my_derive(s: synstructure::Structure) -> proc_macro2::TokenStream { s.gen_impl(quote! { fn my_method() {} }) }
Debug
Known issues
gotchaRequires `proc-macro` crate type and dependencies on `syn`, `quote`, `proc-macro2`
fix
Set `crate-type = ["proc-macro"]` in Cargo.toml and add `syn`, `quote`, `proc-macro2` as dependencies
affects: >=0.10
Upgrade
Version history
0.13.2latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
14
Resources
synstructure — cargo add synstructure · libregistry