#[non_exhaustive]pub struct RecentEmojiEventContent {
pub recent_emoji: Vec<RecentEmoji>,
}Available on crate feature
events only.Expand description
The content of an m.recent_emoji event.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.recent_emoji: Vec<RecentEmoji>The list of recently used emojis, ordered by last usage time.
Implementations§
Source§impl RecentEmojiEventContent
impl RecentEmojiEventContent
Sourcepub const RECOMMENDED_MAX_LEN: usize = 100
pub const RECOMMENDED_MAX_LEN: usize = 100
The maximum length of the list recommended in the Matrix specification.
Sourcepub fn new(recent_emoji: Vec<RecentEmoji>) -> RecentEmojiEventContent
pub fn new(recent_emoji: Vec<RecentEmoji>) -> RecentEmojiEventContent
Creates a new RecentEmojiEventContent from the given list.
Sourcepub fn increment_emoji_total(&mut self, emoji: &str)
pub fn increment_emoji_total(&mut self, emoji: &str)
Increment the total for the given emoji.
If the emoji is in the list, its total is incremented and it is moved to the start of the list.
If the emoji is not in the list, it is added at the start of the list with a total set to
1.
If the length of the list is bigger than RECOMMENDED_MAX_LEN,
the list is truncated.
Sourcepub fn recent_emoji_sorted_by_total(&self) -> Vec<RecentEmoji>
pub fn recent_emoji_sorted_by_total(&self) -> Vec<RecentEmoji>
Get the list of recent emoji sorted by the number of uses.
When several emoji have the same number of uses they are sorted by last usage time.
The returned list is truncated to RECOMMENDED_MAX_LEN.
Trait Implementations§
Source§impl Clone for RecentEmojiEventContent
impl Clone for RecentEmojiEventContent
Source§fn clone(&self) -> RecentEmojiEventContent
fn clone(&self) -> RecentEmojiEventContent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RecentEmojiEventContent
impl Debug for RecentEmojiEventContent
Source§impl<'de> Deserialize<'de> for RecentEmojiEventContent
impl<'de> Deserialize<'de> for RecentEmojiEventContent
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<RecentEmojiEventContent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<RecentEmojiEventContent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<RecentEmojiEventContent> for AnyGlobalAccountDataEventContent
impl From<RecentEmojiEventContent> for AnyGlobalAccountDataEventContent
Source§fn from(c: RecentEmojiEventContent) -> AnyGlobalAccountDataEventContent
fn from(c: RecentEmojiEventContent) -> AnyGlobalAccountDataEventContent
Converts to this type from the input type.
Source§impl GlobalAccountDataEventContent for RecentEmojiEventContent
impl GlobalAccountDataEventContent for RecentEmojiEventContent
Source§fn event_type(&self) -> GlobalAccountDataEventType
fn event_type(&self) -> GlobalAccountDataEventType
Get the event’s type, like
m.push_rules.Source§impl Serialize for RecentEmojiEventContent
impl Serialize for RecentEmojiEventContent
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl JsonCastable<AnyGlobalAccountDataEventContent> for RecentEmojiEventContent
impl JsonCastable<Map<String, Value>> for RecentEmojiEventContent
Auto Trait Implementations§
impl Freeze for RecentEmojiEventContent
impl RefUnwindSafe for RecentEmojiEventContent
impl Send for RecentEmojiEventContent
impl Sync for RecentEmojiEventContent
impl Unpin for RecentEmojiEventContent
impl UnwindSafe for RecentEmojiEventContent
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,
Source§impl<T> EventContentFromType for Twhere
T: StaticEventContent + DeserializeOwned,
impl<T> EventContentFromType for Twhere
T: StaticEventContent + DeserializeOwned,
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
Create a new handle for an Arc value Read more
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
Clone a handle Read more
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Consume a handle, getting back the initial
Arc<> Read more