pub struct ChatMetadata { /* private fields */ }Expand description
A chat row’s display metadata: string → string, which is all the frontend and
the database ever see ({"custom_fields":{..}}, keys in byte order).
A Community channel’s keys are held typed, the community-wide ones in one header its sibling rows share. Any other key, and a known key whose value the typed form could not give back byte for byte, stays a plain pair.
Implementations§
Source§impl ChatMetadata
impl ChatMetadata
pub fn new() -> Self
pub fn set_name(&mut self, name: String)
pub fn get_name(&self) -> Option<&str>
pub fn set_member_count(&mut self, count: usize)
pub fn get_member_count(&self) -> Option<usize>
Sourcepub fn community_id(&self) -> Option<&str>
pub fn community_id(&self) -> Option<&str>
The owning community’s id (hex) on a Community channel row.
Sourcepub fn primary_channel(&self) -> Option<&str>
pub fn primary_channel(&self) -> Option<&str>
The community’s primary channel id (hex), the one row the list renders.
Sourcepub fn is_dissolved(&self) -> bool
pub fn is_dissolved(&self) -> bool
Whether the owner dissolved this row’s community.
Sourcepub fn get(&self, key: &str) -> Option<Cow<'_, str>>
pub fn get(&self, key: &str) -> Option<Cow<'_, str>>
One field’s value, exactly as it serializes.
pub fn contains_key(&self, key: &str) -> bool
pub fn insert(&mut self, key: &str, value: String)
pub fn remove(&mut self, key: &str)
Sourcepub fn entries(&self) -> Vec<(&str, Cow<'_, str>)>
pub fn entries(&self) -> Vec<(&str, Cow<'_, str>)>
Every field in byte order of its key, as it serializes.
pub fn from_map(map: HashMap<String, String>) -> Self
Trait Implementations§
Source§impl Clone for ChatMetadata
impl Clone for ChatMetadata
Source§impl Debug for ChatMetadata
impl Debug for ChatMetadata
Source§impl Default for ChatMetadata
impl Default for ChatMetadata
Source§impl<'de> Deserialize<'de> for ChatMetadata
impl<'de> Deserialize<'de> for ChatMetadata
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
Source§impl PartialEq for ChatMetadata
impl PartialEq for ChatMetadata
Source§impl Serialize for ChatMetadata
impl Serialize for ChatMetadata
impl StructuralPartialEq for ChatMetadata
Auto Trait Implementations§
impl Forget for ChatMetadata
impl Freeze for ChatMetadata
impl Move for ChatMetadata
impl RefUnwindSafe for ChatMetadata
impl Send for ChatMetadata
impl Sync for ChatMetadata
impl Unpin for ChatMetadata
impl UnsafeUnpin for ChatMetadata
impl UnwindSafe for ChatMetadata
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more