notcurses/rust/examples/poc-cjkscroll.rs
joseLuís 6b2805937d rust: add new wrapper type over notcurses struct.
Create new wrapping types that can safely encapsulate the mutable references,
and implement Drop and automatic (de)referencing.

- Notcurses
  - rename Notcurses* to NcNotcurses*.
  - rename NotcursesOptions to NcNotcursesOptions.
  - new Notcurses struct.
    - implement Drop, AsRef, AsMut, Deref & DerefMut.
    - override stop method to be no-op.
    - reimplement constructors and associated methods.
  - remove without_altscreen_with_banners constructor.
- update examples and tests.
- rustfmt.
2021-01-02 19:45:15 +01:00

23 lines
496 B
Rust

//! based on the proof of concept at ../../src/poc/cjkscroll.c
use libnotcurses_sys::*;
fn main() -> NcResult<()> {
let mut nc = Notcurses::new()?;
let plane = nc.stdplane()?;
plane.set_scrolling(true);
let mut wc = '\u{4e00}'; // 一
loop {
plane.putchar(wc)?;
wc = core::char::from_u32(wc as u32 + 1).expect("invalid char");
// 龣
if wc == '\u{9fa5}' {
wc = '\u{4e00}';
}
rsleep![&mut nc, 0, 0, 30];
}
}