Skip to main content

newtype_tools/
lib.rs

1#![doc = include_str!("../README.md")]
2
3pub mod iter;
4
5pub use iter::Iterator;
6#[cfg(feature = "derive")]
7pub use newtype_tools_derive::Newtype;
8
9/// `Newtype` trait defines the internal representation of the `newtype`.
10///
11/// This trait is automatically derived for all types annotated with `#[derive(Newtype)]`
12/// along with the `From<Self::Inner>` and `AsRef<Self::Inner>` traits to convert
13/// between the inner type and the newtype.
14pub trait Newtype: AsRef<Self::Inner> + From<Self::Inner> {
15    /// The inner type.
16    type Inner;
17}