Enum serenity::model::channel::ReactionType [−][src]
#[non_exhaustive] pub enum ReactionType { Custom { animated: bool, id: EmojiId, name: Option<String>, }, Unicode(String), }
Expand description
The type of a Reaction
sent.
Variants (Non-exhaustive)
This enum is marked as non-exhaustive
Show fields
Unicode(String)
Expand description
A reaction with a twemoji.
Implementations
impl ReactionType
[src]
impl ReactionType
[src]pub fn as_data(&self) -> String
[src]
pub fn as_data(&self) -> String
[src]Creates a data-esque display of the type. This is not very useful for displaying, as the primary client can not render it, but can be useful for debugging.
Note: This is mainly for use internally. There is otherwise most likely little use for it.
pub fn unicode_eq(&self, other: &str) -> bool
[src]
pub fn unicode_eq(&self, other: &str) -> bool
[src]Helper function to allow testing equality of unicode emojis without having to perform any allocation. Will always return false if the reaction was not a unicode reaction.
pub fn unicode_partial_cmp(&self, other: &str) -> Option<Ordering>
[src]
pub fn unicode_partial_cmp(&self, other: &str) -> Option<Ordering>
[src]Helper function to allow comparing unicode emojis without having to perform any allocation. Will return None if the reaction was not a unicode reaction.
Trait Implementations
impl Clone for ReactionType
[src]
impl Clone for ReactionType
[src]fn clone(&self) -> ReactionType
[src]
fn clone(&self) -> ReactionType
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl Debug for ReactionType
[src]
impl Debug for ReactionType
[src]impl<'de> Deserialize<'de> for ReactionType
[src]
impl<'de> Deserialize<'de> for ReactionType
[src]fn deserialize<D: Deserializer<'de>>(
deserializer: D
) -> StdResult<Self, D::Error>
[src]
fn deserialize<D: Deserializer<'de>>(
deserializer: D
) -> StdResult<Self, D::Error>
[src]Deserialize this value from the given Serde deserializer. Read more
impl Display for ReactionType
[src]
impl Display for ReactionType
[src]fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult
[src]
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult
[src]Formats the reaction type, displaying the associated emoji in a way that clients can understand.
If the type is a custom emoji, then refer to the documentation for emoji’s formatter on how this is displayed. Otherwise, if the type is a unicode, then the inner unicode is displayed.
impl From<Emoji> for ReactionType
[src]
impl From<Emoji> for ReactionType
[src]fn from(emoji: Emoji) -> ReactionType
[src]
fn from(emoji: Emoji) -> ReactionType
[src]Performs the conversion.
impl From<EmojiId> for ReactionType
[src]
impl From<EmojiId> for ReactionType
[src]fn from(emoji_id: EmojiId) -> ReactionType
[src]
fn from(emoji_id: EmojiId) -> ReactionType
[src]Performs the conversion.
impl From<EmojiIdentifier> for ReactionType
[src]
impl From<EmojiIdentifier> for ReactionType
[src]fn from(emoji_id: EmojiIdentifier) -> ReactionType
[src]
fn from(emoji_id: EmojiIdentifier) -> ReactionType
[src]Performs the conversion.
impl From<char> for ReactionType
[src]
impl From<char> for ReactionType
[src]fn from(ch: char) -> ReactionType
[src]
fn from(ch: char) -> ReactionType
[src]Creates a ReactionType
from a char
.
Examples
Reacting to a message with an apple:
message.react(ctx, '🍎').await?;
impl FromStr for ReactionType
[src]
impl FromStr for ReactionType
[src]impl Hash for ReactionType
[src]
impl Hash for ReactionType
[src]impl PartialEq<ReactionType> for ReactionType
[src]
impl PartialEq<ReactionType> for ReactionType
[src]fn eq(&self, other: &ReactionType) -> bool
[src]
fn eq(&self, other: &ReactionType) -> bool
[src]This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &ReactionType) -> bool
[src]
fn ne(&self, other: &ReactionType) -> bool
[src]This method tests for !=
.
impl Serialize for ReactionType
[src]
impl Serialize for ReactionType
[src]impl<'a> TryFrom<&'a str> for ReactionType
[src]
impl<'a> TryFrom<&'a str> for ReactionType
[src]type Error = ReactionConversionError
type Error = ReactionConversionError
Creates a ReactionType
from a string slice.
Examples
Creating a ReactionType
from a 🍎
, modeling a similar API as the
rest of the library:
use std::convert::TryInto; use std::fmt::Debug; use serenity::model::channel::ReactionType; fn foo<R: TryInto<ReactionType>>(bar: R) where R::Error: Debug, { println!("{:?}", bar.try_into().unwrap()); } foo("🍎");
Creating a ReactionType
from a custom emoji argument in the following format:
use std::convert::TryFrom; use serenity::model::channel::ReactionType; use serenity::model::id::EmojiId; let emoji_string = "<:customemoji:600404340292059257>"; let reaction = ReactionType::try_from(emoji_string).unwrap(); let reaction2 = ReactionType::Custom { animated: false, id: EmojiId(600404340292059257), name: Some("customemoji".to_string()), }; assert_eq!(reaction, reaction2);
impl TryFrom<String> for ReactionType
[src]
impl TryFrom<String> for ReactionType
[src]impl Eq for ReactionType
[src]
impl StructuralEq for ReactionType
[src]
impl StructuralPartialEq for ReactionType
[src]
Auto Trait Implementations
impl RefUnwindSafe for ReactionType
impl Send for ReactionType
impl Sync for ReactionType
impl Unpin for ReactionType
impl UnwindSafe for ReactionType
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]pub fn equivalent(&self, key: &K) -> bool
[src]
pub fn equivalent(&self, key: &K) -> bool
[src]Compare self to key
and return true
if they are equal.
impl<F> FromStrAndCache for F where
F: FromStr,
[src]
impl<F> FromStrAndCache for F where
F: FromStr,
[src]impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,