greyblake / nutype

Rust newtype with guarantees 🇺🇦 🦀

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BREAKING] Rename min_len and max_len on String-based types

greyblake opened this issue · comments

See https://www.reddit.com/r/rust/comments/14j7w46/nutype_030_released/

Term len in context of String has very strong association with String::len() which returns a length of string in bytes.
However, practically in most of the common scenarios strings needs to be validated in terms of chars with str.chars().count().

To avoid the confusion min_len and max_len validators on String-based types have to be renamed.

Candidates:

  • min_chars, max_chars

Addressed in #81