syrup 0.2.0

Simple abstraction around pancurses for chat-like interfaces
Documentation
  • Coverage
  • 0%
    0 out of 21 items documented0 out of 17 items with examples
  • Size
  • Source code size: 32.3 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 817.45 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 18s Average build duration of successful builds.
  • all releases: 18s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • kpcyrd/syrup-rs
    5 1 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • kpcyrd

syrup-rs Build Status Build status crates.io docs.rs

Simple abstraction around pancurses for chat-like interfaces.

# Cargo.toml
[dependencies]
syrup = "0.1"

To get started, see the docs and the examples/ folder.

extern crate syrup;

use syrup::Window;

use std::thread;
use std::sync::mpsc;
use std::time::Duration;


fn main() {
    let mut window = Window::initscr();
    window.writeln("");
    window.writeln(" === welcome to example chat");
    window.writeln("");

    let (tx, rx) = mpsc::channel();
    thread::spawn(move || {
        loop {
            tx.send(String::from("ohai")).unwrap();
            thread::sleep(Duration::from_secs(3));
        }
    });

    loop {
        if let Ok(msg) = rx.try_recv() {
            window.writeln(format!("> {:?}", msg));
        }

        if let Some(line) = window.get() {
            if line == "/quit" {
                break;
            }

            window.writeln(format!("< {:?}", line));
        }
    }
}

License

MIT/Apache-2.0