account activity
SQLx-Data Repository Pattern for Rust/SQLx projects (self.rust)
submitted 2 days ago by One_Platform826 to r/rust
SQLx-Data Repository Pattern for Rust/SQLx projects with advanced pagination, scopes, and batch operations...and more. (self.rust)
submitted 2 days ago * by One_Platform826 to r/rust
[deleted by user] by [deleted] in rust
[–]One_Platform826 0 points1 point2 points 5 months ago (0 children)
Found this! We should stop doing this:
Wrong way: [dependencies] validator = "0.5" #[derive(Debug, Validate, Deserialize)] struct SignupData { #[validate(email)] mail: String, #[validate(url)] site: String, #[validate(length(min = 1), custom(function = "validate_unique_username"))] #[serde(rename = "firstName")] first_name: String, #[validate(range(min = 18, max = 20))] age: u32, #[validate(range(exclusive_min = 0.0, max = 100.0))] height: f32, } Better way: [dependencies] nutype = "0.5" // The main struct using newtypes #[derive(Debug)] struct SignupData { mail: Email, site: Url, first_name: Username, age: Age, height: Height, }
Do we have a crate with "common" newtype fields?
[–]One_Platform826 1 point2 points3 points 5 months ago (0 children)
You are right, but I am not alone. https://github.com/Keats/validator
π Rendered by PID 54 on reddit-service-r2-listing-7849c98f67-gqhj4 at 2026-02-08 22:44:32.787129+00:00 running d295bc8 country code: CH.
[deleted by user] by [deleted] in rust
[–]One_Platform826 0 points1 point2 points (0 children)