[][src]Function showdown::connect

pub async fn connect<'_>(name: &'_ str) -> Result<Stream>

Connects to a named Showdown server.

Returns two structures, [Sender] can be used to send messages to Showdown, while [Receiver] can be used to retrieve messages from Showdown. Due to borrow checker, those structures are separate - it's practically necessary to implement anything interesting.

Examples

use showdown::{connect, Result};

#[tokio::main]
async fn main() {
    assert!(connect("showdown").await.is_ok());
    assert!(connect("fakestofservers").await.is_err());
}