pub struct PrefixedId { /* private fields */ }Implementations§
Source§impl PrefixedId
impl PrefixedId
Sourcepub fn new(prefix: IdPrefix, value: &str) -> Result<PrefixedId, IdPrefixError>
pub fn new(prefix: IdPrefix, value: &str) -> Result<PrefixedId, IdPrefixError>
Creates a prefixed identifier from a validated prefix and value.
§Errors
Returns IdPrefixError::EmptyValue when the trimmed value is empty and
IdPrefixError::InvalidValueCharacter when it contains unsupported characters.
Sourcepub fn parse(input: &str) -> Result<PrefixedId, IdPrefixError>
pub fn parse(input: &str) -> Result<PrefixedId, IdPrefixError>
Parses the canonical prefix_value representation.
§Errors
Returns IdPrefixError::MissingSeparator when the input does not contain _ and the
corresponding prefix or value validation error for malformed parts.
pub const fn prefix(&self) -> &IdPrefix
pub fn value(&self) -> &str
pub fn into_parts(self) -> (IdPrefix, String)
Trait Implementations§
Source§impl Clone for PrefixedId
impl Clone for PrefixedId
Source§fn clone(&self) -> PrefixedId
fn clone(&self) -> PrefixedId
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PrefixedId
impl Debug for PrefixedId
Source§impl Display for PrefixedId
impl Display for PrefixedId
Source§impl Hash for PrefixedId
impl Hash for PrefixedId
Source§impl PartialEq for PrefixedId
impl PartialEq for PrefixedId
Source§fn eq(&self, other: &PrefixedId) -> bool
fn eq(&self, other: &PrefixedId) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for PrefixedId
impl StructuralPartialEq for PrefixedId
Auto Trait Implementations§
impl Freeze for PrefixedId
impl RefUnwindSafe for PrefixedId
impl Send for PrefixedId
impl Sync for PrefixedId
impl Unpin for PrefixedId
impl UnsafeUnpin for PrefixedId
impl UnwindSafe for PrefixedId
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