From 2420f1e75d54a5f209b0267715f078a369d81eb1 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Sun, 23 Mar 2025 15:58:33 -0400 Subject: Rename the `login` module to `user`. --- src/login/validate.rs | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 src/login/validate.rs (limited to 'src/login/validate.rs') diff --git a/src/login/validate.rs b/src/login/validate.rs deleted file mode 100644 index 0c97293..0000000 --- a/src/login/validate.rs +++ /dev/null @@ -1,23 +0,0 @@ -use unicode_segmentation::UnicodeSegmentation as _; - -use crate::name::Name; - -// Picked out of a hat. The power of two is not meaningful. -const NAME_TOO_LONG: usize = 64; - -pub fn name(name: &Name) -> bool { - let display = name.display(); - - [ - display.graphemes(true).count() < NAME_TOO_LONG, - display.chars().all(|ch| !ch.is_control()), - display.chars().next().is_some_and(|c| !c.is_whitespace()), - display.chars().last().is_some_and(|c| !c.is_whitespace()), - display - .chars() - .zip(display.chars().skip(1)) - .all(|(a, b)| !(a.is_whitespace() && b.is_whitespace())), - ] - .into_iter() - .all(|value| value) -} -- cgit v1.2.3