pub trait Name: Sized + AsRef<str> {
const KIND: &'static str;
const MAX_LEN: usize = 64;
// Provided methods
fn validate_char(offset: usize, ch: char) -> Result<(), NameError> { ... }
fn validate(s: &str) -> Result<(), NameError> { ... }
}Expand description
The validation contract shared by every name kind in the system.
Implementers pick the permitted character class and length cap by
overriding Self::validate_char and Self::MAX_LEN. The default
Self::validate implementation enforces the shared “non-empty,
legal identifier start, every character passes validate_char” rule.
Required Associated Constants§
Provided Associated Constants§
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.