Crate qnewtype [] [src]

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);

Macros

qnewtype