From f52c308cb9c99cfb10a49136ee83cef492fe9aa5 Mon Sep 17 00:00:00 2001 From: Sergey Potapov Date: Fri, 30 Jun 2023 06:49:53 +0200 Subject: [PATCH] Add doc about Deref --- README.md | 9 ++++++--- nutype/src/lib.rs | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 359c873..53e4d75 100644 --- a/README.md +++ b/README.md @@ -180,7 +180,8 @@ pub struct PhoneNumber(String); ### String derivable traits The following traits can be derived for a string-based type: -`Debug`, `Clone`, `PartialEq`, `Eq`, `PartialOrd`, `Ord`, `FromStr`, `AsRef`, `From`, `TryFrom`, `Into`, `Hash`, `Borrow`, `Display`, `Default`, `Serialize`, `Deserialize`. +`Debug`, `Clone`, `PartialEq`, `Eq`, `PartialOrd`, `Ord`, `FromStr`, `AsRef`, `Deref`, +`From`, `TryFrom`, `Into`, `Hash`, `Borrow`, `Display`, `Default`, `Serialize`, `Deserialize`. ## Integer @@ -204,7 +205,8 @@ The integer inner types are: `u8`, `u16`,`u32`, `u64`, `u128`, `i8`, `i16`, `i32 ### Integer derivable traits The following traits can be derived for an integer-based type: -`Debug`, `Clone`, `Copy`, `PartialEq`, `Eq`, `PartialOrd`, `Ord`, `FromStr`, `AsRef`, `Into`, `From`, `TryFrom`, `Hash`, `Borrow`, `Display`, `Default`, `Serialize`, `Deserialize`. +`Debug`, `Clone`, `Copy`, `PartialEq`, `Eq`, `PartialOrd`, `Ord`, `FromStr`, `AsRef`, `Deref`, +`Into`, `From`, `TryFrom`, `Hash`, `Borrow`, `Display`, `Default`, `Serialize`, `Deserialize`. ## Float @@ -229,7 +231,8 @@ The float inner types are: `f32`, `f64`. ### Float derivable traits The following traits can be derived for a float-based type: -`Debug`, `Clone`, `Copy`, `PartialEq`, `Eq`, `PartialOrd`, `Ord`, `FromStr`, `AsRef`, `Into`, `From`, `TryFrom`, `Hash`, `Borrow`, `Display`, `Default`, `Serialize`, `Deserialize`. +`Debug`, `Clone`, `Copy`, `PartialEq`, `Eq`, `PartialOrd`, `Ord`, `FromStr`, `AsRef`, `Deref`, +`Into`, `From`, `TryFrom`, `Hash`, `Borrow`, `Display`, `Default`, `Serialize`, `Deserialize`. It's also possible to derive `Eq` and `Ord` if the validation rules guarantee that `NaN` is excluded. This can be done applying by `finite` validation. For example: diff --git a/nutype/src/lib.rs b/nutype/src/lib.rs index 6676fe4..e8fdc3a 100644 --- a/nutype/src/lib.rs +++ b/nutype/src/lib.rs @@ -177,7 +177,8 @@ //! ### String derivable traits //! //! The following traits can be derived for a string-based type: -//! `Debug`, `Clone`, `PartialEq`, `Eq`, `PartialOrd`, `Ord`, `FromStr`, `AsRef`, `From`, `TryFrom`, `Into`, `Hash`, `Borrow`, `Display`, `Default`, `Serialize`, `Deserialize`. +//! `Debug`, `Clone`, `PartialEq`, `Eq`, `PartialOrd`, `Ord`, `FromStr`, `AsRef`, `Deref`, +//! `From`, `TryFrom`, `Into`, `Hash`, `Borrow`, `Display`, `Default`, `Serialize`, `Deserialize`. //! //! //! ## Integer @@ -201,7 +202,8 @@ //! ### Integer derivable traits //! //! The following traits can be derived for an integer-based type: -//! `Debug`, `Clone`, `Copy`, `PartialEq`, `Eq`, `PartialOrd`, `Ord`, `FromStr`, `AsRef`, `Into`, `From`, `TryFrom`, `Hash`, `Borrow`, `Display`, `Default`, `Serialize`, `Deserialize`. +//! `Debug`, `Clone`, `Copy`, `PartialEq`, `Eq`, `PartialOrd`, `Ord`, `FromStr`, `AsRef`, `Deref`, +//! `Into`, `From`, `TryFrom`, `Hash`, `Borrow`, `Display`, `Default`, `Serialize`, `Deserialize`. //! //! //! ## Float @@ -226,7 +228,8 @@ //! ### Float derivable traits //! //! The following traits can be derived for a float-based type: -//! `Debug`, `Clone`, `Copy`, `PartialEq`, `Eq`, `PartialOrd`, `Ord`, `FromStr`, `AsRef`, `Into`, `From`, `TryFrom`, `Hash`, `Borrow`, `Display`, `Default`, `Serialize`, `Deserialize`. +//! `Debug`, `Clone`, `Copy`, `PartialEq`, `Eq`, `PartialOrd`, `Ord`, `FromStr`, `AsRef`, `Deref`, +//! `Into`, `From`, `TryFrom`, `Hash`, `Borrow`, `Display`, `Default`, `Serialize`, `Deserialize`. //! //! It's also possible to derive `Eq` and `Ord` if the validation rules guarantee that `NaN` is excluded. //! This can be done by applying `finite` validation. For example: