pub struct JmapUri { /* private fields */ }Expand description
A parsed jmap:<type>:<accountId>:<objectId> URI.
Build one with JmapUri::new or parse one with str::parse;
Display renders it back to the wire string. The URI
arrives in peer-supplied values, so parsing validates every segment.
use jmap_types::JmapUri;
let uri: JmapUri = "jmap:calendarevent:a1:e42".parse().unwrap();
assert_eq!(uri.data_type(), "calendarevent");
assert_eq!(uri.account_id().as_ref(), "a1");
assert_eq!(uri.object_id().as_ref(), "e42");
assert_eq!(uri.to_string(), "jmap:calendarevent:a1:e42");Implementations§
Source§impl JmapUri
impl JmapUri
Sourcepub fn new(
data_type: impl Into<String>,
account_id: Id,
object_id: Id,
) -> Result<Self, JmapUriError>
pub fn new( data_type: impl Into<String>, account_id: Id, object_id: Id, ) -> Result<Self, JmapUriError>
Build a URI from its parts.
§Errors
Returns JmapUriError when data_type is not lowercase ASCII
alphanumeric or either id fails RFC 8620 §1.2 validation (an
unvalidated Id::from could otherwise smuggle a : into the
rendered URI).
Sourcepub fn account_id(&self) -> &Id
pub fn account_id(&self) -> &Id
The account the object lives on.
Trait Implementations§
impl Eq for JmapUri
impl StructuralPartialEq for JmapUri
Auto Trait Implementations§
impl Freeze for JmapUri
impl RefUnwindSafe for JmapUri
impl Send for JmapUri
impl Sync for JmapUri
impl Unpin for JmapUri
impl UnsafeUnpin for JmapUri
impl UnwindSafe for JmapUri
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