Skip to main content

Previous

Enum Previous 

Source
#[non_exhaustive]
pub enum Previous {
Show 19 variants None, CurrentUser(Arc<CurrentUser>), Guild(Arc<CachedGuild>), Channel(Arc<Channel>), Role(Arc<Role>), Emojis(Vec<Arc<Emoji>>), Stickers(Vec<Arc<Sticker>>), Member(Arc<CachedMember>), Members(Vec<Arc<CachedMember>>), Message(Arc<CachedMessage>), Messages(Vec<Arc<CachedMessage>>), Presence(Arc<CachedPresence>), VoiceState(Arc<VoiceState>), Thread(Arc<Channel>), Threads(Vec<Arc<Channel>>), ScheduledEvent(Arc<GuildScheduledEvent>), StageInstance(Arc<StageInstance>), SoundboardSound(Arc<SoundboardSound>), SoundboardSounds(Vec<Arc<SoundboardSound>>),
}
Expand description

The previous state returned by Cache::update_dispatch: the UpdateCache::Previous of the event, in a variant per kind.

discord.js counterpart: the old values discord.js’ events pass (oldMessage, oldMember, …).

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

None

The event changes nothing in the cache, or nothing was cached before it.

§

CurrentUser(Arc<CurrentUser>)

The current user before a [Ready] or [UserUpdate].

§

Guild(Arc<CachedGuild>)

A guild before a [GuildCreate], [GuildUpdate] or [GuildDelete].

§

Channel(Arc<Channel>)

A channel before a channel event.

§

Role(Arc<Role>)

A role before a role event.

§

Emojis(Vec<Arc<Emoji>>)

A guild’s emojis before a [GuildEmojisUpdate].

§

Stickers(Vec<Arc<Sticker>>)

A guild’s stickers before a [GuildStickersUpdate].

§

Member(Arc<CachedMember>)

A member before a member event.

§

Members(Vec<Arc<CachedMember>>)

The members a [GuildMembersChunk] replaced.

§

Message(Arc<CachedMessage>)

A message before a message or reaction event.

§

Messages(Vec<Arc<CachedMessage>>)

The messages a [MessageDeleteBulk] removed.

§

Presence(Arc<CachedPresence>)

A presence before a [PresenceUpdate].

§

VoiceState(Arc<VoiceState>)

A voice state before a [VoiceStateUpdate].

§

Thread(Arc<Channel>)

A thread before a thread event.

§

Threads(Vec<Arc<Channel>>)

The threads a [ThreadListSync] replaced.

§

ScheduledEvent(Arc<GuildScheduledEvent>)

A scheduled event before a scheduled event event.

§

StageInstance(Arc<StageInstance>)

A stage instance before a stage instance event.

§

SoundboardSound(Arc<SoundboardSound>)

A soundboard sound before a soundboard sound event.

§

SoundboardSounds(Vec<Arc<SoundboardSound>>)

The soundboard sounds a [GuildSoundboardSoundsUpdate] or [SoundboardSounds] replaced.

Trait Implementations§

Source§

impl Clone for Previous

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Previous

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<Option<Previous>> for Previous

Source§

fn from(previous: Option<Self>) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Previous

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Previous

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.