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
sourceimpl ActivityButton
impl ActivityButton
Trait Implementations
sourceimpl Clone for ActivityButton
impl Clone for ActivityButton
sourcefn clone(&self) -> ActivityButton
fn clone(&self) -> ActivityButton
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresourceimpl Debug for ActivityButton
impl Debug for ActivityButton
sourceimpl<'de> Deserialize<'de> for ActivityButton
impl<'de> Deserialize<'de> for ActivityButton
sourcefn 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
sourceimpl Hash for ActivityButton
impl Hash for ActivityButton
sourceimpl PartialEq<ActivityButton> for ActivityButton
impl PartialEq<ActivityButton> for ActivityButton
sourcefn eq(&self, other: &ActivityButton) -> bool
fn eq(&self, other: &ActivityButton) -> bool
sourceimpl Serialize for ActivityButton
impl Serialize for ActivityButton
impl Eq for ActivityButton
impl StructuralEq for ActivityButton
impl StructuralPartialEq for ActivityButton
Auto Trait Implementations
impl RefUnwindSafe for ActivityButton
impl Send for ActivityButton
impl Sync for ActivityButton
impl Unpin for ActivityButton
impl UnwindSafe for ActivityButton
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more