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