Crate impl_tools
source ·Expand description
Impl-tools
#[autoimpl] is a partial replacement for #[derive], supporting:
- Explicit
whereclause on generic parameters - No implicit bounds on generic parameters beyond those required by the type
- Traits like
Derefbyusinga named field - Traits like
Debugmayignorenamed fields
#[autoimpl] may also be used on trait definitions to re-implement the
trait for given reference types.
impl_scope! is a function-like macro used to define a type plus its
implementations. It supports two things:
impl Selfsyntax- Evaluation of advanced attribute macros, which may use field initializers and read/write other impls within the scope
singleton! is a function-like macro used to define and instantiate a
unique (single-use) type. It supports everything supported by impl_scope!
plus field initializers and (limited) automatic typing of fields.
User-extensions to both #[autoimpl] and impl_scope! are possible, by
writing your own proc-macro crate depending on
impl-tools-lib.
Macros
Scope supporting
impl Self and advanced attribute macrosConstruct a single-instance struct
Attribute Macros
An alternative to the standard
derive macroImpl
Default with given field or type initializers