pub enum ActivityButton {
Link(ActivityButtonLink),
Text(ActivityButtonText),
Unknown,
}Expand description
Button used in an activity.
serde
Activity buttons with a URL deserialize and serialize as a struct:
use twilight_model::gateway::presence::activity_button::{ActivityButton, ActivityButtonLink};
const JSON: &str = r#"{
"label": "a",
"url": "b"
}"#;
assert_eq!(
ActivityButton::Link(ActivityButtonLink {
label: "a".to_owned(),
url: "b".to_owned(),
}),
serde_json::from_str(JSON)?,
);An activity button without a URL - an ActivityButtonText - will
deserialize and serialize as a string. This means that a textual activity
button with a label of “test” will serialize as simply the string “test” and
vice versa.
use twilight_model::gateway::presence::activity_button::{ActivityButton, ActivityButtonText};
assert_eq!(
ActivityButton::Text(ActivityButtonText {
label: "test".to_owned(),
}),
serde_json::from_str(r#""test""#)?,
);Variants§
Link(ActivityButtonLink)
Activity button is a link.
Text(ActivityButtonText)
Activity button is textual.
Unknown
Variant value is unknown to the library.
Implementations§
Trait Implementations§
source§impl Clone for ActivityButton
impl Clone for ActivityButton
source§fn clone(&self) -> ActivityButton
fn clone(&self) -> ActivityButton
Returns a copy 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 ActivityButton
impl Debug for ActivityButton
source§impl<'de> Deserialize<'de> for ActivityButton
impl<'de> Deserialize<'de> for ActivityButton
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 Hash for ActivityButton
impl Hash for ActivityButton
source§impl PartialEq<ActivityButton> for ActivityButton
impl PartialEq<ActivityButton> for ActivityButton
source§fn eq(&self, other: &ActivityButton) -> bool
fn eq(&self, other: &ActivityButton) -> bool
This method tests for
self and other values to be equal, and is used
by ==.