macro_rules! impl_as_ref {
    ($ty:ty, $inner:ty) => { ... };
    ($ty:ty, $inner:ty, $field:ident) => { ... };
}
Expand description

Implement AsRef for a newtype struct.

The first argument is that of the newtype struct to create the impl for and the second is the wrapped type.

Examples

use impl_more::impl_as_ref;

struct Foo(String);

impl_as_ref!(Foo, String);

let foo = Foo("bar".to_owned());
assert_eq!(foo.as_ref(), "bar");