pub enum AtprotoStr<S: Bos<str> + AsRef<str> = DefaultStr> {
Datetime(Datetime),
Language(Language),
Tid(Tid),
Nsid(Nsid<S>),
Did(Did<S>),
Handle(Handle<S>),
AtIdentifier(AtIdentifier<S>),
AtUri(AtUri<S>),
Uri(UriValue<S>),
Cid(Cid<S>),
RecordKey(RecordKey<Rkey<S>>),
String(S),
}Expand description
Polymorphic AT Protocol string value
Represents any AT Protocol string type, automatically detecting and parsing into the appropriate variant. Used internally for generic value handling.
Variants are checked in order from most specific to least specific. Note that record keys are intentionally NOT parsed from bare strings as the validation is too permissive and would catch too many values.
Variants§
Datetime(Datetime)
ISO 8601 datetime
Language(Language)
BCP 47 language tag
Tid(Tid)
Timestamp identifier
Nsid(Nsid<S>)
Namespaced identifier
Did(Did<S>)
Decentralized identifier
Handle(Handle<S>)
Account handle
AtIdentifier(AtIdentifier<S>)
Identifier (DID or handle)
AtUri(AtUri<S>)
AT URI
Uri(UriValue<S>)
Generic URI
Cid(Cid<S>)
Content identifier
RecordKey(RecordKey<Rkey<S>>)
Record key
String(S)
Plain string (fallback)
Implementations§
Source§impl<S: Bos<str> + AsRef<str>> AtprotoStr<S>
impl<S: Bos<str> + AsRef<str>> AtprotoStr<S>
Sourcepub fn new(string: S) -> Self
pub fn new(string: S) -> Self
Classify and wrap a string value into the appropriate variant.
This is fairly exhaustive and potentially slow, prefer using anything that narrows down the search field quicker.
Inspects the string content, validates against known AT Protocol types,
and moves string into the matching variant via unchecked constructors
(safe because we validate first).
Sourcepub fn string_type(&self) -> LexiconStringType
pub fn string_type(&self) -> LexiconStringType
Detailed string type classification.
Trait Implementations§
Source§impl<S: Clone + Bos<str> + AsRef<str>> Clone for AtprotoStr<S>
impl<S: Clone + Bos<str> + AsRef<str>> Clone for AtprotoStr<S>
Source§fn clone(&self) -> AtprotoStr<S>
fn clone(&self) -> AtprotoStr<S>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'de, S> Deserialize<'de> for AtprotoStr<S>
impl<'de, S> Deserialize<'de> for AtprotoStr<S>
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
impl<S: Eq + Bos<str> + AsRef<str>> Eq for AtprotoStr<S>
Source§impl<S: Bos<str> + AsRef<str> + Clone + Serialize> From<AtprotoStr<S>> for String
impl<S: Bos<str> + AsRef<str> + Clone + Serialize> From<AtprotoStr<S>> for String
Source§fn from(value: AtprotoStr<S>) -> Self
fn from(value: AtprotoStr<S>) -> Self
Source§impl<S> From<AtprotoStr<S>> for Data<S>
impl<S> From<AtprotoStr<S>> for Data<S>
Source§fn from(t: AtprotoStr<S>) -> Self
fn from(t: AtprotoStr<S>) -> Self
Source§impl<S: Bos<str> + AsRef<str> + IntoStatic> IntoStatic for AtprotoStr<S>
impl<S: Bos<str> + AsRef<str> + IntoStatic> IntoStatic for AtprotoStr<S>
Source§type Output = AtprotoStr<<S as IntoStatic>::Output>
type Output = AtprotoStr<<S as IntoStatic>::Output>
Cow<'a, str>, this is Cow<'static, str>, for example.Source§fn into_static(self) -> Self::Output
fn into_static(self) -> Self::Output
Source§impl<S: PartialEq + Bos<str> + AsRef<str>> PartialEq for AtprotoStr<S>
impl<S: PartialEq + Bos<str> + AsRef<str>> PartialEq for AtprotoStr<S>
Source§fn eq(&self, other: &AtprotoStr<S>) -> bool
fn eq(&self, other: &AtprotoStr<S>) -> bool
self and other values to be equal, and is used by ==.impl<S: Bos<str> + AsRef<str>> StructuralPartialEq for AtprotoStr<S>
Auto Trait Implementations§
impl<S> Freeze for AtprotoStr<S>where
S: Freeze,
impl<S> RefUnwindSafe for AtprotoStr<S>where
S: RefUnwindSafe,
impl<S> Send for AtprotoStr<S>where
S: Send,
impl<S> Sync for AtprotoStr<S>where
S: Sync,
impl<S> Unpin for AtprotoStr<S>where
S: Unpin,
impl<S> UnsafeUnpin for AtprotoStr<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for AtprotoStr<S>where
S: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.