Skip to main content

Newtype

Trait Newtype 

Source
pub trait Newtype: AsRef<Self::Inner> + From<Self::Inner> {
    type Inner;
}
Expand description

Newtype trait defines the internal representation of the newtype.

This trait is automatically derived for all types annotated with #[derive(Newtype)] along with the From<Self::Inner> and AsRef<Self::Inner> traits to convert between the inner type and the newtype.

Required Associated Types§

Source

type Inner

The inner type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§