pub struct AtUri<'a> {
authority: &'a str,
collection: Option<&'a str>,
rkey: Option<&'a str>,
}Expand description
A parsed at:// URI in its restricted form.
The parts are borrowed from the input, so an AtUri never re-renders the
string it came from and cannot disagree with it.
Fields§
§collection: Option<&'a str>§rkey: Option<&'a str>Implementations§
Source§impl<'a> AtUri<'a>
impl<'a> AtUri<'a>
The repository this URI names: a DID or a handle, as written.
Sourcepub fn collection(self) -> Option<&'a str>
pub fn collection(self) -> Option<&'a str>
The collection, if the URI names one.
Sourcepub fn rkey(self) -> Option<&'a str>
pub fn rkey(self) -> Option<&'a str>
The record key, if the URI names a single record.
A URI with a collection but no record key names the collection itself, which is a listing rather than a record.
Sourcepub fn parse(uri: &'a str) -> Result<Self, AtUriError>
pub fn parse(uri: &'a str) -> Result<Self, AtUriError>
Parses an at:// URI.
use didbot_schema::aturi::AtUri;
let uri = AtUri::parse("at://did:plc:asdf123/com.atproto.feed.post/record")?;
assert_eq!(uri.authority(), "did:plc:asdf123");
assert_eq!(uri.rkey(), Some("record"));
assert!(AtUri::parse("at://did:plc:asdf123/").is_err()); // trailing slash
assert!(AtUri::parse("at://did:plc:asdf123#").is_err()); // fragmentTrait Implementations§
impl<'a> Copy for AtUri<'a>
impl<'a> Eq for AtUri<'a>
impl<'a> StructuralPartialEq for AtUri<'a>
Auto Trait Implementations§
impl<'a> Freeze for AtUri<'a>
impl<'a> RefUnwindSafe for AtUri<'a>
impl<'a> Send for AtUri<'a>
impl<'a> Sync for AtUri<'a>
impl<'a> Unpin for AtUri<'a>
impl<'a> UnsafeUnpin for AtUri<'a>
impl<'a> UnwindSafe for AtUri<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.