pub struct RawKey { /* private fields */ }Expand description
A key’s text split into venue, product and id, checked by no product yet.
RawKey::parse splits at the first :, then what comes before it at its
first .. The id is everything after the :, so it may hold : and .
of its own. The venue and product must be ids (an ASCII lowercase letter,
then lowercase letters, digits and -) and the id must not be empty; the
id is otherwise kept as written, since only its product knows its
canonical form.
It serializes as its text form and deserializes through
RawKey::parse.
use polyoxide_venue::RawKey;
let raw = RawKey::parse("acme.events:FED-25DEC:yes")?;
assert_eq!(raw.venue().as_str(), "acme");
assert_eq!(raw.product().as_str(), "events");
assert_eq!(raw.id(), "FED-25DEC:yes");
assert!(RawKey::parse("acme:spot").is_err());Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for RawKey
impl<'de> Deserialize<'de> for RawKey
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl Eq for RawKey
impl StructuralPartialEq for RawKey
Auto Trait Implementations§
impl Freeze for RawKey
impl RefUnwindSafe for RawKey
impl Send for RawKey
impl Sync for RawKey
impl Unpin for RawKey
impl UnsafeUnpin for RawKey
impl UnwindSafe for RawKey
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