pub enum ActivityButton {
Link(ActivityButtonLink),
Text(ActivityButtonText),
}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::{
ActivityButtonLink,
ActivityButton,
};
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::{
ActivityButtonText,
ActivityButton,
};
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.
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 more
sourceimpl 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
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &ActivityButton) -> bool
fn ne(&self, other: &ActivityButton) -> bool
This method tests for !=.
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 T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more