Enum twitch_api2::pubsub::TopicSubscribe [−][src]
This is supported on crate feature
pubsub
only.Command that can be serialized to be sent to twitchs PubSub server to subscribe or unsubscribe to a Topic
Variants
Subscribe/Listen
Fields of Listen
Unsubscribe/Unlisten
Fields of Unlisten
Implementations
impl TopicSubscribe
[src]
pub fn to_command(&self) -> Result<String, Error>
[src]
Convert this TopicSubscribe
to a string which you can send with your client
pub fn listen<'a, T: Topic, O: Into<Option<String>>>(
topics: &'a [T],
auth_token: String,
nonce: O
) -> TopicSubscribe where
&'a T: Into<String>,
[src]
topics: &'a [T],
auth_token: String,
nonce: O
) -> TopicSubscribe where
&'a T: Into<String>,
Create a listen command.
Example
Create a listen message for moderator actions
// We want to subscribe to moderator actions on channel with id 1234 // as if we were a user with id 4321 that is moderator on the channel. let topic = pubsub::moderation::ChatModeratorActions { user_id: 4321, channel_id: 1234, }; // Create the topic command to send to twitch let command = pubsub::TopicSubscribe::listen( &[topic], "authtoken".to_string(), "super se3re7 random string".to_string(), ) .to_command().expect("serializing failed"); // Send the message with your favorite websocket client send_command(command).unwrap(); // To parse the websocket messages, use pubsub::Response::parse
pub fn unlisten<'a, T: Topic, O: Into<Option<String>>>(
topics: &'a [T],
auth_token: String,
nonce: O
) -> TopicSubscribe where
&'a T: Into<String>,
[src]
topics: &'a [T],
auth_token: String,
nonce: O
) -> TopicSubscribe where
&'a T: Into<String>,
Create a unlisten command.
Trait Implementations
impl Serialize for TopicSubscribe
[src]
Auto Trait Implementations
impl RefUnwindSafe for TopicSubscribe
[src]
impl Send for TopicSubscribe
[src]
impl Sync for TopicSubscribe
[src]
impl Unpin for TopicSubscribe
[src]
impl UnwindSafe for TopicSubscribe
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<T> WithSubscriber for T
[src]
pub fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,