Primitive Wrapper
Primitive Wrapper is a small derive macro for generating operation trait implementations for primitive wrapper structs, making the inner value transparent:
;
The implemented traits are:
- Arithmetic:
Add,Sub,Mul,Div,Rem,Neg - Bitwise:
Not,BitAnd,BitOr,BitXor,Shl,Shr - Passthrough Formatting:
Debug,Display,Binary,LowerExp,LowerHex,Octal,UpperExp,UpperHex - Comparison:
PartialEq/PartialOrdwith the inner type
By default, all of the above traits are implemented. These groups can also be selected individually:
;
Prior Art
This crate provides similar functionality to the newtype_derive
crate, but the derived traits are specified individually. It is more generalized for all new-type patterns,
whereas this crate is designed only for new-types wrapping integers, floats, and bool. Use newtype_derive if you
need more fine-grained control over the traits implemented.