pub trait IntoKey<T: KeyDomain> {
// Required methods
fn into_key(self) -> Result<Key<T>, KeyParseError>;
fn try_into_key(self) -> Option<Key<T>>;
}Expand description
Helper trait for converting strings to keys
This trait provides convenient methods for converting various string types into keys with proper error handling.
Required Methods§
Sourcefn into_key(self) -> Result<Key<T>, KeyParseError>
fn into_key(self) -> Result<Key<T>, KeyParseError>
Convert into a key, returning an error if validation fails
§Errors
Returns KeyParseError if the string fails validation for the domain
Sourcefn try_into_key(self) -> Option<Key<T>>
fn try_into_key(self) -> Option<Key<T>>
Convert into a key, returning None if validation fails
This is useful when you want to filter out invalid keys rather than handle errors explicitly.