| Crates.io | async-tw-econ |
| lib.rs | async-tw-econ |
| version | 0.9.0 |
| created_at | 2025-10-29 15:58:10.839696+00 |
| updated_at | 2026-01-06 18:54:57.602805+00 |
| description | Simple Rust library to use Teeworlds external console asynchronously |
| homepage | |
| repository | https://github.com/gerdoe-jr/async-tw-econ |
| max_upload_size | |
| id | 1906864 |
| size | 8,766 |
Rust library provides you a simple asynchronous interface to interconnect with Teeworlds external console.
Beware! Only tokio runtime is supported since async-std TcpStream seems to be unusable in this context.
Let's say you have Teeworlds server running with ec_password zohan and ec_port 6060 and you want to use it's econ.
use async_tw_econ::Econ;
#[tokio::main]
async fn main() -> std::io::Result<()> {
let mut econ = Econ::new();
econ.connect("127.0.0.1:6060").await?;
let authed = econ.try_auth("nahoz").await?;
assert_eq!(authed, false);
let authed = econ.try_auth("hozan").await?;
assert_eq!(authed, false);
let authed = econ.try_auth("zohan").await?;
assert_eq!(authed, true);
econ.send_line("echo \"Hi\"").await?;
econ.fetch().await?;
println!("{}", econ.pop_line()?);
Ok(())
}