tw-econ

Crates.iotw-econ
lib.rstw-econ
version0.9.0
created_at2021-05-29 18:23:46.425738+00
updated_at2026-01-06 18:54:53.768258+00
descriptionSimple Rust library to use Teeworlds external console
homepage
repositoryhttps://github.com/gerdoe-jr/tw-econ
max_upload_size
id403583
size8,455
gerdoe (gerdoe-jr)

documentation

README

tw-econ

Description

Rust library provides you a simple synchronous interface to interconnect with Teeworlds external console.

Example

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 tw_econ::Econ;

fn main() -> std::io::Result<()> {
    let mut econ = Econ::new();

    econ.connect("127.0.0.1:6060")?;

    let authed = econ.try_auth("nahoz")?;
    assert_eq!(authed, false);

    let authed = econ.try_auth("hozan")?;
    assert_eq!(authed, false);

    let authed = econ.try_auth("zohan")?;
    assert_eq!(authed, true);

    econ.send_line("echo \"Hi\"")?;

    econ.fetch()?;
    
    println!("{}", econ.pop_line()?);

    Ok(())
}

Projects

Commit count: 48

cargo fmt