pub struct PathDomain;Expand description
A domain for file path-like keys
This domain allows forward slashes and is suitable for hierarchical keys that resemble file paths:
- Allows alphanumeric, underscore, hyphen, dot, and forward slash
- Case-insensitive
- No consecutive slashes
- Cannot start or end with slash
§Examples
use domain_key::{Key, PathDomain};
type PathKey = Key<PathDomain>;
let key = PathKey::new("users/profile/settings")?;
assert_eq!(key.as_str(), "users/profile/settings");Trait Implementations§
Source§impl Debug for PathDomain
impl Debug for PathDomain
Source§impl Domain for PathDomain
impl Domain for PathDomain
Source§const DOMAIN_NAME: &'static str = "path"
const DOMAIN_NAME: &'static str = "path"
Human-readable name for this domain Read more
Source§impl KeyDomain for PathDomain
impl KeyDomain for PathDomain
Source§const MAX_LENGTH: usize = 256
const MAX_LENGTH: usize = 256
Maximum length for keys in this domain Read more
Source§const EXPECTED_LENGTH: usize = 48
const EXPECTED_LENGTH: usize = 48
Optimization hint: expected average key length for this domain Read more
Source§const TYPICALLY_SHORT: bool = false
const TYPICALLY_SHORT: bool = false
Optimization hint: whether keys in this domain are typically short (≤32 chars) Read more
Source§const CASE_INSENSITIVE: bool = true
const CASE_INSENSITIVE: bool = true
Whether keys in this domain are case-insensitive Read more
Source§const FREQUENTLY_SPLIT: bool = true
const FREQUENTLY_SPLIT: bool = true
Optimization hint: whether keys in this domain are frequently split Read more
Source§const HAS_CUSTOM_VALIDATION: bool = true
const HAS_CUSTOM_VALIDATION: bool = true
Whether this domain has custom validation rules Read more
Source§fn allowed_characters(c: char) -> bool
fn allowed_characters(c: char) -> bool
Check which characters are allowed for this domain Read more
Source§fn allowed_start_character(c: char) -> bool
fn allowed_start_character(c: char) -> bool
Check if a character is allowed at the start of a key Read more
Source§fn allowed_end_character(c: char) -> bool
fn allowed_end_character(c: char) -> bool
Check if a character is allowed at the end of a key Read more
Source§fn allowed_consecutive_characters(prev: char, curr: char) -> bool
fn allowed_consecutive_characters(prev: char, curr: char) -> bool
Check if two consecutive characters are allowed Read more
Source§fn default_separator() -> char
fn default_separator() -> char
Get the default separator character for this domain Read more
Source§fn validate_domain_rules(key: &str) -> Result<(), KeyParseError>
fn validate_domain_rules(key: &str) -> Result<(), KeyParseError>
Domain-specific validation rules Read more
Source§fn validation_help() -> Option<&'static str>
fn validation_help() -> Option<&'static str>
Get domain-specific help text for validation errors Read more
Source§const HAS_CUSTOM_NORMALIZATION: bool = false
const HAS_CUSTOM_NORMALIZATION: bool = false
Whether this domain has custom normalization rules Read more
Source§const FREQUENTLY_COMPARED: bool = false
const FREQUENTLY_COMPARED: bool = false
Optimization hint: whether keys in this domain are frequently compared Read more
Source§fn normalize_domain(key: Cow<'_, str>) -> Cow<'_, str>
fn normalize_domain(key: Cow<'_, str>) -> Cow<'_, str>
Domain-specific normalization Read more
Source§fn is_reserved_prefix(_key: &str) -> bool
fn is_reserved_prefix(_key: &str) -> bool
Check if a key has a reserved prefix for this domain Read more
Source§fn is_reserved_suffix(_key: &str) -> bool
fn is_reserved_suffix(_key: &str) -> bool
Check if a key has a reserved suffix for this domain Read more
Source§fn requires_ascii_only(_key: &str) -> bool
fn requires_ascii_only(_key: &str) -> bool
Check if the key contains only ASCII characters Read more
Source§fn min_length() -> usize
fn min_length() -> usize
Get the minimum allowed length for keys in this domain Read more
Auto Trait Implementations§
impl Freeze for PathDomain
impl RefUnwindSafe for PathDomain
impl Send for PathDomain
impl Sync for PathDomain
impl Unpin for PathDomain
impl UnsafeUnpin for PathDomain
impl UnwindSafe for PathDomain
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more