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