Nutype 0.4.0
Acknowledgements
A heartfelt thanks to Daniyil Glushko for his invaluable assistance and exceptional work on this release. Daniyil, located in Zaporizhzhia, Ukraine, is a proficient Rust developer open to remote opportunities. I highly recommend reaching out to him for Rust development roles.
Changes
- [FEATURE] Support of arbitrary inner types with custom sanitizers and validators.
 - [FEATURE] Add numeric validator 
greater - [FEATURE] Add numeric validator 
less - [BREAKING] Removal of asterisk derive
 - [BREAKING] Use commas to separate high level attributes
 - [BREAKING] Traits are derived with 
#[nutype(derive(Debug))]. The regular#[derive(Debug)]syntax is not supported anymore. - [BREAKING] Validator 
withhas been renamed topredicateto reflect the boolean nature of its range - [BREAKING] String validator 
min_lenhas been renamed tolen_char_minto reflect that is based on UTF8 chars. - [BREAKING] String validator 
max_lenhas been renamed tolen_char_maxto reflect that is based on UTF8 chars. - [BREAKING] Rename numeric validator 
maxtoless_or_equal - [BREAKING] Rename numeric validator 
mintogreater_or_equal - [BREAKING] Rename error variants to follow the following formula: 
<ValidationRule>Violated. This implies the following renames:TooShort->LenCharMinViolatedTooLong->LenCharMaxViolatedEmpty->NotEmptyViolatedRegexMismatch->RegexViolatedInvalid->PredicateViolatedTooBig->LessOrEqualViolatedTooSmall->GreaterOrEqualViolatedNotFinite->FiniteViolated
 - Better error messages: in case of unknown attribute, validator or sanitizer the possible values are listed.
 - [FIX] Make derived 
Deserializework with RON format 
Feature highlights
Arbitrary inner type
Previously #[nutype] worked only with String, integers and floats.
Now it's possible to use it with any arbitrary type (e.g. Vec<String>):
#[nutype(
    validate(predicate = |friends| !friends.is_empty() ),
)]
pub struct Frieds(Vec<String>);New numeric validators
Instead of former min and max integers and floats can now be validated with:
greater_or_equal- Inclusive lower boundgreater- Exclusive lower boundless_or_equal- Inclusive upper boundless- Exclusive upper bound
Example:
#[nutype(
    validate(
        greater_or_equal = 0,
        less_or_equal = 59,
    ),
)]
pub struct Minute(u8);Derive
Deriving of traits now has to be done explicitly with #[nutype(derive(...))] instead of #[derive(...)]:
Example:
#[nutype(
    validate(with = |n| n % 2 == 1),
    derive(Debug, Clone, Copy)
)]
pub struct OddNumber(u64);This makes it clear, that deriving is fully handled by #[nutype] and prevents a potential confusion.