From bc803503840c78ac166251068bdafc8edabdbd34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?joseLu=C3=ADs?= Date: Sat, 10 Apr 2021 15:29:55 +0200 Subject: [PATCH] [rust] several fixes - fix after renaming cell functions. - fix some NcVisual method names and docs - fix some rustdoc warnings --- rust/src/cells/methods.rs | 8 ++++++-- rust/src/direct/methods.rs | 5 +++-- rust/src/plane/methods.rs | 5 +++-- rust/src/plane/mod.rs | 4 ++-- rust/src/visual.rs | 17 +++++++++-------- 5 files changed, 23 insertions(+), 16 deletions(-) diff --git a/rust/src/cells/methods.rs b/rust/src/cells/methods.rs index 5a09f3119..e94c89fe9 100644 --- a/rust/src/cells/methods.rs +++ b/rust/src/cells/methods.rs @@ -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); } } } diff --git a/rust/src/direct/methods.rs b/rust/src/direct/methods.rs index a852481f5..d696eb3c1 100644 --- a/rust/src/direct/methods.rs +++ b/rust/src/direct/methods.rs @@ -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> { diff --git a/rust/src/plane/methods.rs b/rust/src/plane/methods.rs index 9ecee4d90..7b7f1b7b2 100644 --- a/rust/src/plane/methods.rs +++ b/rust/src/plane/methods.rs @@ -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 { diff --git a/rust/src/plane/mod.rs b/rust/src/plane/mod.rs index 48ff37d3f..272ecb74b 100644 --- a/rust/src/plane/mod.rs +++ b/rust/src/plane/mod.rs @@ -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 diff --git a/rust/src/visual.rs b/rust/src/visual.rs index ea35a192e..8f2d1ba04 100644 --- a/rust/src/visual.rs +++ b/rust/src/visual.rs @@ -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.*