Struct showdown::SendMessage [−][src]
Implementations
impl SendMessage
[src]
pub fn global_command(command: impl Display) -> Self
[src]
Creates a global command.
Example
use futures::{SinkExt, StreamExt}; use showdown::message::{Kind, QueryResponse}; use showdown::{Result, RoomId, SendMessage, Stream}; #[tokio::main] async fn main() -> Result<()> { let mut stream = Stream::connect("showdown").await?; stream.send(SendMessage::global_command("cmd rooms")).await?; while let Some(received) = stream.next().await { if let Kind::QueryResponse(QueryResponse::Rooms(rooms)) = received?.kind() { assert!(rooms .official .iter() .any(|room| room.title == "Tournaments")); return Ok(()); } } panic!("Server didn't provide a list of rooms"); }
pub fn chat_message(room_id: RoomId<'_>, message: impl Display) -> Self
[src]
Creates a command that executes in a chat room.
Examples
use futures::{SinkExt, StreamExt}; use showdown::message::{Kind, QueryResponse}; use showdown::{Result, RoomId, SendMessage, Stream}; #[tokio::main] async fn main() -> Result<()> { let mut stream = Stream::connect("showdown").await?; stream.send(SendMessage::global_command("join lobby")).await?; stream.send(SendMessage::chat_message(RoomId::LOBBY, "roomdesc")).await; while let Some(message) = stream.next().await { if let Kind::Html(html) = message?.kind() { assert!(html.contains("Relax here amidst the chaos.")); return Ok(()); } } panic!("Server didn't provide a room description"); }
pub fn chat_command(room_id: RoomId<'_>, command: impl Display) -> Self
[src]
Creates a chat room command message.
pub fn broadcast_command(room_id: RoomId<'_>, command: impl Display) -> Self
[src]
Trait Implementations
impl Clone for SendMessage
[src]
fn clone(&self) -> SendMessage
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for SendMessage
[src]
impl Eq for SendMessage
[src]
impl PartialEq<SendMessage> for SendMessage
[src]
fn eq(&self, other: &SendMessage) -> bool
[src]
fn ne(&self, other: &SendMessage) -> bool
[src]
impl Sink<SendMessage> for Stream
[src]
type Error = Error
The type of value produced by the sink when an error occurs.
fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
[src]
fn start_send(self: Pin<&mut Self>, item: SendMessage) -> Result<()>
[src]
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
[src]
fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
[src]
impl StructuralEq for SendMessage
[src]
impl StructuralPartialEq for SendMessage
[src]
Auto Trait Implementations
impl RefUnwindSafe for SendMessage
[src]
impl Send for SendMessage
[src]
impl Sync for SendMessage
[src]
impl Unpin for SendMessage
[src]
impl UnwindSafe for SendMessage
[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<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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>,