pub struct Object<S = DefaultStr>(pub BTreeMap<SmolStr, Data<S>>)
where
S: Bos<str> + AsRef<str>;Expand description
Object/map of AT Protocol data values
Tuple Fields§
§0: BTreeMap<SmolStr, Data<S>>Implementations§
Source§impl<S> Object<S>
impl<S> Object<S>
Sourcepub fn get_mut(&mut self, key: &str) -> Option<&mut Data<S>>
pub fn get_mut(&mut self, key: &str) -> Option<&mut Data<S>>
Get a mutable reference to a value by key
Sourcepub fn contains_key(&self, key: &str) -> bool
pub fn contains_key(&self, key: &str) -> bool
Check if a key exists in the object
Sourcepub fn type_discriminator(&self) -> Option<&str>
pub fn type_discriminator(&self) -> Option<&str>
Get the “$type” discriminator field if present and it’s a string
This is a shortcut for union type discrimination in AT Protocol.
Trait Implementations§
Source§impl<'de, 'a, S> Deserialize<'de> for Object<S>
impl<'de, 'a, S> Deserialize<'de> for Object<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>,
Deserialize this value from the given Serde deserializer. Read more
impl<S> Eq for Object<S>
Source§impl<S> IntoStatic for Object<S>
impl<S> IntoStatic for Object<S>
Source§type Output = Object<<S as IntoStatic>::Output>
type Output = Object<<S as IntoStatic>::Output>
The “owned” variant of the type. For
Cow<'a, str>, this is Cow<'static, str>, for example.Source§fn into_static(self) -> Object<<S as IntoStatic>::Output>
fn into_static(self) -> Object<<S as IntoStatic>::Output>
Turns the value into an “owned” variant, which can then be returned, moved, etc. Read more
impl<S> StructuralPartialEq for Object<S>
Auto Trait Implementations§
impl<S> Freeze for Object<S>
impl<S> RefUnwindSafe for Object<S>where
S: RefUnwindSafe,
impl<S> Send for Object<S>where
S: Send,
impl<S> Sync for Object<S>where
S: Sync,
impl<S> Unpin for Object<S>
impl<S> UnsafeUnpin for Object<S>
impl<S> UnwindSafe for Object<S>where
S: RefUnwindSafe,
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<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
Compare self to
key and return true if they are equal.