Skip to main content

CacheableMessage

Trait CacheableMessage 

Source
pub trait CacheableMessage:
    From<Message>
    + PartialEq<Message>
    + PartialEq<Self>
    + Clone
    + Debug {
    // Required methods
    fn reactions(&self) -> &[Reaction];
    fn reactions_mut(&mut self) -> &mut [Reaction];
    fn retain_reactions(&mut self, f: impl FnMut(&Reaction) -> bool);
    fn clear_reactions(&mut self);
    fn add_reaction(&mut self, reaction: Reaction);
    fn remove_reaction(&mut self, idx: usize);
}
Expand description

Trait for a generic cached representation of a Message.

Required Methods§

Source

fn reactions(&self) -> &[Reaction]

Reactions added to this message.

Source

fn reactions_mut(&mut self) -> &mut [Reaction]

Mutable getter for reactions added to this message.

Source

fn retain_reactions(&mut self, f: impl FnMut(&Reaction) -> bool)

Retain all reactions to this message matching a predicate, removing non-matching ones.

Source

fn clear_reactions(&mut self)

Clear all reactions to this message.

Source

fn add_reaction(&mut self, reaction: Reaction)

Add a reaction to this message.

Source

fn remove_reaction(&mut self, idx: usize)

Remove a reaction from this message.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§