Crates.io | newtype-ops |
lib.rs | newtype-ops |
version | 0.1.4 |
source | src |
created_at | 2016-12-15 04:02:44.263363 |
updated_at | 2019-05-16 20:27:18.395466 |
description | Mass-derive many operators for newtypes. Wartier than newtype_derive. |
homepage | |
repository | https://github.com/ExpHP/newtype-ops |
max_upload_size | |
id | 7585 |
size | 37,042 |
A operator-deriving macro for newtypes that is wartier than newtype_derive
,
and therefore better.[Citation needed]
pub struct Foo(i32);
newtype_ops! { [Foo] integer {:=} {^&}Self {^&}{Self i32} }
// alternatively
newtype_ops! { [Foo] {add sub mul div rem neg not bitand bitor bitxor} {:=} {^&}Self {^&}{Self i32} }
So for once I have finally decided to actually publish a crate this time.
Cargo.toml
[dependencies]
newtype-ops = "0.1"
Funny thing, actually, pretty much the sole reason I published the crate was so that I could link to docs.rs.
See the documentation for newtype_ops!
WTFPL 2.0