Skip to main content

newtype

Attribute Macro newtype 

Source
#[newtype]
Expand description

Parses and expands a newtype attribute kind into a token stream.

The crate supports predefined sets of newtype properties. The concept is similar to the phantom_newtype crate but avoids its limitations, as the newtype generated here is a distinct Rust type. This allows new traits to be implemented easily for the type and makes the set of derived traits simple to extend.

#[newtype(Amount)]
#[derive(Default)]
struct Apples(u64);