[−][src]Struct showdown::Sender
Message sender.
Implementations
impl Sender
[src]
pub async fn send_global_command<'_>(
&'_ mut self,
command: impl Display
) -> Result<()>
[src]
&'_ mut self,
command: impl Display
) -> Result<()>
Sends a global command.
Example
use futures::prelude::*; use showdown::message::{Kind, QueryResponse}; use showdown::{connect, Result, RoomId}; #[tokio::main] async fn main() -> Result<()> { let (mut sender, mut receiver) = connect("showdown").await?; sender.send_global_command("cmd rooms").await?; loop { let received = receiver.receive().await?; if let Kind::QueryResponse(QueryResponse::Rooms(rooms)) = received.kind() { assert!(rooms .official .iter() .any(|room| room.title == "Tournaments")); return Ok(()); } } }
pub async fn send_chat_message<'_, '_>(
&'_ mut self,
room_id: RoomId<'_>,
message: impl Display
) -> Result<()>
[src]
&'_ mut self,
room_id: RoomId<'_>,
message: impl Display
) -> Result<()>
Sends a message in a chat room.
pub async fn send_chat_command<'_, '_>(
&'_ mut self,
room_id: RoomId<'_>,
command: impl Display
) -> Result<()>
[src]
&'_ mut self,
room_id: RoomId<'_>,
command: impl Display
) -> Result<()>
Sends a command in a chat room.
Examples
use futures::prelude::*; use showdown::message::{Kind, QueryResponse}; use showdown::{connect, Result, RoomId}; #[tokio::main] async fn main() -> Result<()> { let (mut sender, mut receiver) = connect("showdown").await?; sender.send_global_command("join lobby").await?; sender.send_chat_command(RoomId::LOBBY, "roomdesc").await; loop { if let Kind::Html(html) = receiver.receive().await?.kind() { assert!(html.contains("Relax here amidst the chaos.")); return Ok(()); } } }
pub async fn broadcast_command<'_, '_>(
&'_ mut self,
room_id: RoomId<'_>,
command: impl Display
) -> Result<()>
[src]
&'_ mut self,
room_id: RoomId<'_>,
command: impl Display
) -> Result<()>
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Sender
impl Send for Sender
impl Sync for Sender
impl Unpin for Sender
impl !UnwindSafe for Sender
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,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[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.
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.
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>,