notcurses/rust/examples/poc-kittyzapper.rs
joseLuís b12abeddc9 rust: finish NcDirect error system refactor
- change Option return type for NcResult when appropriate.
- make NcDirect constructors return NcResult.
- rename NcError::new() to with_msg() and simplify new().
- refactor examples:
  - rename direct-image.rs to direct-image-c.rs
  - recreate using rust methods, as direct-image-rust.rs
  - differentiate more throughly between both styles.
  - remove the sys namespace on both examples.
2020-12-25 17:41:02 +01:00

26 lines
506 B
Rust

//! based on the proof of concept at ../../src/poc/kittyzapper.c
use libnotcurses_sys::*;
fn main() -> NcResult<()> {
let ncd = NcDirect::new()?;
ncd.fg_rgb8(100, 100, 100)?;
ncd.bg_rgb8(0xff, 0xff, 0xff)?;
printf!("a");
ncd.bg_rgb8(0, 0, 0)?;
printf!("b");
printf!(" ");
printf!(" ");
ncd.bg_rgb8(0, 0, 1)?;
printf!("c");
printf!(" ");
printf!(" ");
ncd.bg_rgb8(0xff, 0xff, 0xff)?;
printf!("d");
printf!("\n");
ncd.stop()?;
Ok(())
}