rust: finish adding Notcurses methods.

pull/1253/head
joseLuís 4 years ago
parent fa693a89c1
commit 4c048ef625

@ -263,6 +263,19 @@ impl Notcurses {
crate::notcurses_getc_nblocking(self, input) crate::notcurses_getc_nblocking(self, input)
} }
/// Gets a file descriptor suitable for input event poll()ing.
///
/// When this descriptor becomes available, you can call
/// [getc_nblock][Notcurses#method.getc_nblock](), and input ought be ready.
///
/// This file descriptor is not necessarily the file descriptor associated
/// with stdin (but it might be!).
///
/// C style function: [notcurses_inputready_fd][crate::notcurses_inputready_fd]
pub fn inputready_fd(&mut self) -> NcResult {
unsafe { crate::notcurses_inputready_fd(self) }
}
/// Returns an [NcBlitter] from a string representation. /// Returns an [NcBlitter] from a string representation.
/// ///
/// C style function: [notcurses_lex_blitter][crate::notcurses_lex_blitter] /// C style function: [notcurses_lex_blitter][crate::notcurses_lex_blitter]
@ -366,6 +379,24 @@ impl Notcurses {
unsafe { crate::notcurses_render(self) } unsafe { crate::notcurses_render(self) }
} }
/// Performs the rendering and rasterization portion of
/// [render][Notcurses#method.render] but do not write the resulting buffer
/// out to the terminal.
///
/// Using this function, the user can control the writeout process,
/// and render a second frame while writing another.
///
/// The returned buffer must be freed by the caller.
///
/// C style function: [notcurses_render_to_buffer][crate::notcurses_render_to_buffer]
//
// CHECK that this works.
pub fn render_to_buffer(&mut self, buffer: &mut Vec<u8>) -> NcResult {
let mut len = buffer.len() as u64;
let mut buf = buffer.as_mut_ptr() as *mut i8;
unsafe { crate::notcurses_render_to_buffer(self, &mut buf, &mut len) }
}
/// Writes the last rendered frame, in its entirety, to 'fp'. /// Writes the last rendered frame, in its entirety, to 'fp'.
/// ///
/// If [render][Notcurses#method.render]() has not yet been called, /// If [render][Notcurses#method.render]() has not yet been called,
@ -470,7 +501,6 @@ impl Notcurses {
unsafe { &mut *crate::notcurses_top(self) } unsafe { &mut *crate::notcurses_top(self) }
} }
/// Returns a human-readable string describing the running Notcurses version. /// Returns a human-readable string describing the running Notcurses version.
/// ///
/// C style function: [notcurses_version][crate::notcurses_version] /// C style function: [notcurses_version][crate::notcurses_version]

@ -3,7 +3,7 @@
// functions already exported by bindgen : 41 // functions already exported by bindgen : 41
// ------------------------------------------ // ------------------------------------------
// (#) test: 10 // (#) test: 10
// (W) wrap: 38 // (W) wrap: 40 / 1
// ------------------------------------------ // ------------------------------------------
//W notcurses_at_yx //W notcurses_at_yx
//W notcurses_bottom //W notcurses_bottom
@ -20,7 +20,7 @@
//W# notcurses_drop_planes //W# notcurses_drop_planes
//W notcurses_getc //W notcurses_getc
//W# notcurses_init //W# notcurses_init
// notcurses_inputready_fd //W notcurses_inputready_fd
//W notcurses_lex_blitter //W notcurses_lex_blitter
//W notcurses_lex_margins //W notcurses_lex_margins
//W notcurses_lex_scalemode //W notcurses_lex_scalemode
@ -31,7 +31,7 @@
//W notcurses_palette_size //W notcurses_palette_size
//W notcurses_refresh //W notcurses_refresh
//W notcurses_render //W notcurses_render
// notcurses_render_to_buffer //W notcurses_render_to_buffer
//W notcurses_render_to_file //W notcurses_render_to_file
//W notcurses_stats //W notcurses_stats
//W notcurses_stats_alloc //W notcurses_stats_alloc
@ -43,7 +43,7 @@
//W notcurses_str_scalemode //W notcurses_str_scalemode
//W notcurses_supported_styles //W notcurses_supported_styles
//W notcurses_top //W notcurses_top
// notcurses_ucs32_to_utf8 //~ notcurses_ucs32_to_utf8 (not needed in rust)
//W notcurses_version //W notcurses_version
//W notcurses_version_components //W notcurses_version_components
// //

Loading…
Cancel
Save