You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For this release I'd like to thank Daniyil Glushko, who offered his help and did a very good job.
Daniyil is located in Zaporizhzhia (Ukraine) and could be interested in a Rust job. If you're looking for a Rust developer remotely, I'd recommend contacting him.
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 with has been renamed to predicate to reflect the boolean nature of its range
[BREAKING] String validator min_len has been renamed to len_char_min to reflect that is based on UTF8 chars.
[BREAKING] String validator max_len has been renamed to len_char_max to reflect that is based on UTF8 chars.
[BREAKING] Rename numeric validator max to less_or_equal
[BREAKING] Rename numeric validator min to greater_or_equal
[BREAKING] Rename error variants to follow the following formula: <ValidationRule>Violated. This implies the following renames:
TooShort -> LenCharMinViolated
TooLong -> LenCharMaxViolated
Empty -> NotEmptyViolated
RegexMismatch -> RegexViolated
Invalid -> PredicateViolated
TooBig -> LessOrEqualViolated
TooSmall -> GreaterOrEqualViolated
NotFinite -> FiniteViolated
Better error messages: in case of unknown attribute, validator or sanitizer the possible values are listed.
[FIX] Make derived Deserialize work 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>):
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
For this release I'd like to thank Daniyil Glushko, who offered his help and did a very good job.
Daniyil is located in Zaporizhzhia (Ukraine) and could be interested in a Rust job. If you're looking for a Rust developer remotely, I'd recommend contacting him.
Changes
greater
less
#[nutype(derive(Debug))]
. The regular#[derive(Debug)]
syntax is not supported anymore.with
has been renamed topredicate
to reflect the boolean nature of its rangemin_len
has been renamed tolen_char_min
to reflect that is based on UTF8 chars.max_len
has been renamed tolen_char_max
to reflect that is based on UTF8 chars.max
toless_or_equal
min
togreater_or_equal
<ValidationRule>Violated
. This implies the following renames:TooShort
->LenCharMinViolated
TooLong
->LenCharMaxViolated
Empty
->NotEmptyViolated
RegexMismatch
->RegexViolated
Invalid
->PredicateViolated
TooBig
->LessOrEqualViolated
TooSmall
->GreaterOrEqualViolated
NotFinite
->FiniteViolated
Deserialize
work with RON formatFeature highlights
Arbitrary inner type
Previously
#[nutype]
worked only withString
, integers and floats.Now it's possible to use it with any arbitrary type (e.g.
Vec<String>
):New numeric validators
Instead of former
min
andmax
integers and floats can now be validated with:greater_or_equal
- Inclusive lower boundgreater
- Exclusive lower boundless_or_equal
- Inclusive upper boundless
- Exclusive upper boundExample:
Derive
Deriving of traits now has to be done explicitly with
#[nutype(derive(...))]
instead of#[derive(...)]
:Example:
This makes it clear, that deriving is fully handled by
#[nutype]
and prevents a potential confusion.This discussion was created from the release Nutype 0.4.0.
Beta Was this translation helpful? Give feedback.
All reactions