rust: more fixes and improvements
- fix notcurses_init unit test - fix fn call name: `nplane_at_cursor_cell` → `ncplane_at_cursor_cell`. - make LIBC_FILE & NC_FILE type aliases with doc comment. - add lib module comment. - improve direct-cursor example. - fix full-text example and rename it to full-basics.pull/1118/head
parent
9fe0363937
commit
4de2652f8d
@ -0,0 +1,30 @@
|
||||
// utility macro: sleep for $ms milliseconds
|
||||
macro_rules! sleep {
|
||||
($ms:expr) => {
|
||||
std::thread::sleep(std::time::Duration::from_millis($ms));
|
||||
};
|
||||
}
|
||||
|
||||
// utility macro: convert the String $s to *mut CString
|
||||
// macro_rules! cstring {
|
||||
// ($s:expr) => {
|
||||
// std::ffi::CString::new($s).unwrap().as_ptr();
|
||||
// }
|
||||
// }
|
||||
|
||||
use libnotcurses_sys::*;
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
let nc = Notcurses::new();
|
||||
let stdplane = notcurses_stdplane(nc);
|
||||
|
||||
let c1 = cell_char_initializer!('A');
|
||||
ncplane_putc(&mut *stdplane, &c1);
|
||||
|
||||
let _ = notcurses_render(nc);
|
||||
|
||||
sleep![1200];
|
||||
notcurses_stop(nc);
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
use std::thread::sleep;
|
||||
use std::time::Duration;
|
||||
use std::ffi::CString;
|
||||
|
||||
/// utility macro: sleep for $s seconds
|
||||
macro_rules! sleep {
|
||||
($s:expr) => {
|
||||
sleep(Duration::new($s, 0));
|
||||
};
|
||||
}
|
||||
|
||||
/// utility macro: convert the String $s to *mut CString
|
||||
macro_rules! cstring {
|
||||
($s:expr) => {
|
||||
CString::new($s).unwrap().as_ptr();
|
||||
}
|
||||
}
|
||||
|
||||
use libnotcurses_sys::*;
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
let nc = Notcurses::new();
|
||||
|
||||
println!("WIP");
|
||||
sleep![2];
|
||||
|
||||
notcurses_stop(nc);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue