1 unstable release
Uses old Rust 2015
0.1.0 | May 29, 2016 |
---|
#87 in #meta
4KB
A simple macro for creating newtype-structs (MyType(X)
).
qnewtype! {
#[meta]...
[pub] type MyType: X;
...
}
Corresponds to
#[meta]...
[pub] struct MyType(X);
impl From<X> for MyType {
...
}
impl Into<X> for MyType {
...
}
impl ::std::ops::Deref for MyType {
type Target = X;
...
}
impl ::std::ops::DerefMut for MyType {
...
}
...
If there's only statement, you can omit the semicolon.
qnewtype!([pub] type MyType: X);