{"repo":"greyblake/nutype","free":true,"listed":false,"github":"https://github.com/greyblake/nutype","clone":"git clone https://github.com/greyblake/nutype.git","description":"Rust newtype with guarantees 🇺🇦 🦀","language":"Rust","stars":1761,"topics":["data","data-structures","macro","macros","newtype","rust","rust-lang","rust-library","sanitization","sanitizer"],"license":"MIT","category":"dev-tools","readme_excerpt":"The newtype with guarantees. Nutype is a proc macro that allows adding extra constraints like sanitization and validation to the regular newtype pattern. The generated code makes it impossible to instantiate a value without passing the checks. It works this way even with serde deserialization. Quick start Inner types (String Integer Float Decimal Other) Custom (sanitizers validators errors) Deriving traits Constants Recipes Constructor visibility Breaking constraints with new unchecked Feature Flags Support Ukrainian military forces Similar projects Quick start For more please see: Examples Tests Inner types Available sanitizers, validators, and derivable traits are determined by the inner type, which falls into the following categories: String Integer ( u8 , u16 , u32 , u64 , u128 , i8 , i16 , i32 , i64 , i128 , usize , isize ) Float ( f32 , f64 ) Decimal ( rust decimal::Decimal , requires the rust decimal feature) Anything else String At the moment the string inner type supports only String (owned) type. String sanitizers Sanitizer Description Example ------------- ------------------------------------------------------------------------------------- ------------------------------------------------- trim Removes leading and trailing whitespaces trim lowercase Converts the string to lowercase lowercase uppercase Converts the string to uppercase uppercase with Custom sanitizer. A function or closure that receives String and returns String with = \\ mut s: String\\ ( s.truncate(5","default_branch":null,"files":null,"tree":[],"storefront":"/r/greyblake","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/greyblake/nutype/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}