[rust] several fixes

- fix after renaming cell functions.
- fix some NcVisual method names and docs
- fix some rustdoc warnings
This commit is contained in:
joseLuís 2021-04-10 15:29:55 +02:00
parent 9fdfd33d30
commit bc80350384
5 changed files with 23 additions and 16 deletions

View File

@ -5,6 +5,10 @@ use crate::{
NcPaletteIndex, NcPlane, NcResult, NcRgb, NcStyleMask, NCRESULT_ERR,
};
#[allow(unused_imports)]
// imports for doc comments
use crate::NcChannel;
/// # NcCell constructors
impl NcCell {
/// New NcCell, expects a 7-bit [char].
@ -83,7 +87,7 @@ impl NcCell {
///
/// *C style function: [cell_duplicate()][crate::cell_duplicate].*
pub fn duplicate(&self, target: &mut NcCell, common_plane: &mut NcPlane) -> NcResult<()> {
error![unsafe { crate::cell_duplicate(common_plane, target, self) }]
error![unsafe { crate::nccell_duplicate(common_plane, target, self) }]
}
/// Initializes (zeroes out) the NcCell.
@ -99,7 +103,7 @@ impl NcCell {
/// *C style function: [cell_release()][crate::cell_release].*
pub fn release(&mut self, plane: &mut NcPlane) {
unsafe {
crate::cell_release(plane, self);
crate::nccell_release(plane, self);
}
}
}

View File

@ -545,8 +545,9 @@ impl NcDirect {
///
/// Initializes Readline the first time it's called.
///
/// For input to be echoed to the terminal, it is necessary that
/// [NCDIRECT_OPTION_INHIBIT_CBREAK] be provided to [ncdirect_init]
/// For input to be echoed to the terminal, it is necessary that the flag
/// [NCDIRECT_OPTION_INHIBIT_CBREAK][crate::NCDIRECT_OPTION_INHIBIT_CBREAK]
/// be provided to the constructor.
///
/// *C style function: [ncdirect_readline()][crate::ncdirect_readline].*
pub fn readline(&mut self, prompt: &str) -> NcResult<&str> {

View File

@ -1470,8 +1470,9 @@ impl NcPlane {
/// Returns an [NcPixelGeometry] structure filled with pixel geometry for
/// the display region, each cell, and the maximum displayable bitmap.
///
/// This function calls [notcurses_check_pixel_support], possibly leading to
/// an interrogation of the terminal.
/// This function calls
/// [notcurses_check_pixel_support][crate::notcurses_check_pixel_support],
/// possibly leading to an interrogation of the terminal.
///
/// *C style function: [ncplane_pixelgeom()][crate::ncplane_pixelgeom].*
pub fn pixelgeom(&mut self) -> NcPixelGeometry {

View File

@ -322,7 +322,7 @@ pub const NCBLIT_BRAILLE: NcBlitter = crate::bindings::ffi::ncblitter_e_NCBLIT_B
/// [`NcBlitter`] mode where the blitter is automatically chosen
pub const NCBLIT_DEFAULT: NcBlitter = crate::bindings::ffi::ncblitter_e_NCBLIT_DEFAULT;
/// [`NcPixel`] mode
/// Sixel/Pixel mode
///
/// See [Sixel in Wikipedia](https://en.wikipedia.org/wiki/Sixel).
pub const NCBLIT_PIXEL: NcBlitter = crate::bindings::ffi::ncblitter_e_NCBLIT_PIXEL;
@ -330,7 +330,7 @@ pub const NCBLIT_PIXEL: NcBlitter = crate::bindings::ffi::ncblitter_e_NCBLIT_PIX
/// Contains the pixel geometry information as returned by the
/// NcPlane.[pixelgeom()][NcPlane#method.pixelgeom] method.
///
/// If bitmaps are not supported, the fields max_bitmap_[yx] will be 0.
/// If bitmaps are not supported, the fields `max_bitmap_*` will be 0.
#[derive(Clone, Debug)]
pub struct NcPixelGeometry {
/// Geometry of the display region

View File

@ -162,7 +162,7 @@ impl NcVisualOptions {
/// # NcVisual Constructors & destructors
impl NcVisual {
/// Like [ncvisual_from_rgba], but 'bgra' is arranged as BGRA.
/// Like [from_rgba][NcVisual#method.from_rgba], but 'bgra' is arranged as BGRA.
///
/// *C style function: [ncvisual_from_bgra()][crate::ncvisual_from_bgra].*
pub fn from_bgra<'a>(
@ -187,8 +187,8 @@ impl NcVisual {
/// Opens a visual at `file`, extracts the codec and parameters and
/// decodes the first image to memory.
///
/// *C style function: [ncvisual_from_bgra()][crate::ncvisual_from_bgra].*
pub fn ncvisual_from_file<'a>(file: &str) -> NcResult<&'a mut NcVisual> {
/// *C style function: [ncvisual_from_file()][crate::ncvisual_from_file].*
pub fn from_file<'a>(file: &str) -> NcResult<&'a mut NcVisual> {
error_ref_mut![
unsafe { crate::ncvisual_from_file(cstring![file]) },
&format!("NcVisual::from_file()")
@ -201,10 +201,11 @@ impl NcVisual {
/// This will be checked, and any other glyph will result in an error.
///
/// This function exists so that planes can be subjected to NcVisual transformations.
/// If possible, it's better to create the ncvisual from memory using [ncvisual_from_rgba].
/// If possible, it's better to create the ncvisual from memory using
/// [from_rgba][NcVisual#method.from_rgba].
///
/// *C style function: [ncvisual_from_bgra()][crate::ncvisual_from_bgra].*
pub fn ncvisual_from_plane<'a>(
/// *C style function: [ncvisual_from_plane()][crate::ncvisual_from_plane].*
pub fn from_plane<'a>(
plane: &NcPlane,
blitter: NcBlitter,
beg_y: NcDim,
@ -293,8 +294,8 @@ impl NcVisual {
}
}
/// Extracts the next frame from the NcVisual, ala [decode], but if we have
/// reached the end, rewinds to the first frame.
/// Extracts the next frame from the NcVisual, ala [decode][NcVisual#method.decode],
/// but if we have reached the end, rewinds to the first frame.
///
/// *A subsequent [NcVisual.render]() will render the first frame,
/// as if the ncvisual had been closed and reopened.*