From da5f86cc8f6373d8afdc22f30c204034a0ce0202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?joseLu=C3=ADs?= Date: Fri, 8 Jan 2021 19:25:46 +0100 Subject: [PATCH] rust: rename NcDimension to NcDim; rustfmt --- rust/src/cells/methods.rs | 8 +- rust/src/cells/test/methods.rs | 2 +- rust/src/dimension.rs | 8 +- rust/src/direct/methods.rs | 54 +++---- rust/src/direct/wrapper.rs | 4 +- rust/src/fade.rs | 2 +- rust/src/input/mod.rs | 6 +- rust/src/macros.rs | 2 +- rust/src/notcurses/methods.rs | 45 +++--- rust/src/notcurses/reimplemented.rs | 18 +-- rust/src/notcurses/wrapper.rs | 5 +- rust/src/palette/methods.rs | 2 +- rust/src/plane/helpers.rs | 10 +- rust/src/plane/methods.rs | 239 ++++++++++++---------------- rust/src/plane/reimplemented.rs | 75 ++++----- 15 files changed, 211 insertions(+), 269 deletions(-) diff --git a/rust/src/cells/methods.rs b/rust/src/cells/methods.rs index cf579d5e9..5af77c931 100644 --- a/rust/src/cells/methods.rs +++ b/rust/src/cells/methods.rs @@ -48,12 +48,8 @@ impl NcCell { /// /// The styling of the cell is left untouched, but any resources are released. /// *C style function: [cell_load()][crate::cell_load].* - pub fn load( - plane: &mut NcPlane, - cell: &mut NcCell, - egc: &str, - ) -> NcResult { - let bytes = unsafe { crate::cell_load(plane, cell, cstring![egc])}; + pub fn load(plane: &mut NcPlane, cell: &mut NcCell, egc: &str) -> NcResult { + let bytes = unsafe { crate::cell_load(plane, cell, cstring![egc]) }; error![ bytes, &format!["NcCell.load(NcPlane, NcCell, {:?})", egc], diff --git a/rust/src/cells/test/methods.rs b/rust/src/cells/test/methods.rs index 9ccc50d38..1f125565a 100644 --- a/rust/src/cells/test/methods.rs +++ b/rust/src/cells/test/methods.rs @@ -1,6 +1,6 @@ //! Test `NcCell` methods and associated functions. -use crate::{NcCell, NcPlane, FullMode}; +use crate::{FullMode, NcCell, NcPlane}; use serial_test::serial; diff --git a/rust/src/dimension.rs b/rust/src/dimension.rs index 173674dac..61f4622c3 100644 --- a/rust/src/dimension.rs +++ b/rust/src/dimension.rs @@ -1,7 +1,7 @@ -//! `NcDimension`, `NcOffset` +//! `NcDim`, `NcOffset` -/// A dimension in rows or columns. Can't be negative. -pub type NcDimension = u32; +/// Represents a dimension in rows or columns. Can't be negative. +pub type NcDim = u32; -/// An offset in rows or columns. Can be negative. +/// Represents an offset in rows or columns. Can be negative. pub type NcOffset = i32; diff --git a/rust/src/direct/methods.rs b/rust/src/direct/methods.rs index 60734b0bb..920102bac 100644 --- a/rust/src/direct/methods.rs +++ b/rust/src/direct/methods.rs @@ -4,9 +4,9 @@ use core::ptr::{null, null_mut}; use crate::ffi::sigset_t; use crate::{ - cstring, error, error_ref_mut, NcAlign, NcBlitter, NcChannelPair, NcColor, NcDimension, - NcDirect, NcDirectFlags, NcEgc, NcError, NcInput, NcPaletteIndex, NcPlane, NcResult, NcRgb, - NcScale, NcStyleMask, NcTime, NCRESULT_ERR, + cstring, error, error_ref_mut, NcAlign, NcBlitter, NcChannelPair, NcColor, NcDim, NcDirect, + NcDirectFlags, NcEgc, NcError, NcInput, NcPaletteIndex, NcPlane, NcResult, NcRgb, NcScale, + NcStyleMask, NcTime, NCRESULT_ERR, }; /// # `NcDirect` constructors and destructors @@ -306,7 +306,7 @@ impl NcDirect { /// Moves the cursor down, `num` rows. /// /// *C style function: [ncdirect_cursor_down()][crate::ncdirect_cursor_down].* - pub fn cursor_down(&mut self, num: NcDimension) -> NcResult<()> { + pub fn cursor_down(&mut self, num: NcDim) -> NcResult<()> { error![ unsafe { crate::ncdirect_cursor_down(self, num as i32) }, &format!("NcDirect.cursor_down({})", num) @@ -316,7 +316,7 @@ impl NcDirect { /// Moves the cursor left, `num` columns. /// /// *C style function: [ncdirect_cursor_left()][crate::ncdirect_cursor_left].* - pub fn cursor_left(&mut self, num: NcDimension) -> NcResult<()> { + pub fn cursor_left(&mut self, num: NcDim) -> NcResult<()> { error![ unsafe { crate::ncdirect_cursor_left(self, num as i32) }, &format!("NcDirect.cursor_left({})", num) @@ -326,7 +326,7 @@ impl NcDirect { /// Moves the cursor right, `num` columns. /// /// *C style function: [ncdirect_cursor_right()][crate::ncdirect_cursor_right].* - pub fn cursor_right(&mut self, num: NcDimension) -> NcResult<()> { + pub fn cursor_right(&mut self, num: NcDim) -> NcResult<()> { error![ unsafe { crate::ncdirect_cursor_right(self, num as i32) }, &format!("NcDirect.cursor_right({})", num) @@ -336,7 +336,7 @@ impl NcDirect { /// Moves the cursor up, `num` rows. /// /// *C style function: [ncdirect_cursor_up()][crate::ncdirect_cursor_up].* - pub fn cursor_up(&mut self, num: NcDimension) -> NcResult<()> { + pub fn cursor_up(&mut self, num: NcDim) -> NcResult<()> { error![ unsafe { crate::ncdirect_cursor_up(self, num as i32) }, &format!("NcDirect.cursor_up({})", num) @@ -346,21 +346,21 @@ impl NcDirect { /// Moves the cursor in direct mode to the specified row, column. /// /// *C style function: [ncdirect_cursor_move_yx()][crate::ncdirect_cursor_move_yx].* - pub fn cursor_move_yx(&mut self, y: NcDimension, x: NcDimension) -> NcResult<()> { + pub fn cursor_move_yx(&mut self, y: NcDim, x: NcDim) -> NcResult<()> { error![unsafe { crate::ncdirect_cursor_move_yx(self, y as i32, x as i32) }] } /// Moves the cursor in direct mode to the specified row. /// /// *(No equivalent C style function)* - pub fn cursor_move_y(&mut self, y: NcDimension) -> NcResult<()> { + pub fn cursor_move_y(&mut self, y: NcDim) -> NcResult<()> { error![unsafe { crate::ncdirect_cursor_move_yx(self, y as i32, -1) }] } /// Moves the cursor in direct mode to the specified column. /// /// *(No equivalent C style function)* - pub fn cursor_move_x(&mut self, x: NcDimension) -> NcResult<()> { + pub fn cursor_move_x(&mut self, x: NcDim) -> NcResult<()> { error![unsafe { crate::ncdirect_cursor_move_yx(self, -1, x as i32) }] } @@ -371,12 +371,12 @@ impl NcDirect { /// the results might be detrimental. /// /// *C style function: [ncdirect_cursor_yx()][crate::ncdirect_cursor_yx].* - pub fn cursor_yx(&mut self) -> NcResult<(NcDimension, NcDimension)> { + pub fn cursor_yx(&mut self) -> NcResult<(NcDim, NcDim)> { let (mut y, mut x) = (0, 0); error![ unsafe { crate::ncdirect_cursor_yx(self, &mut y, &mut x) }, "", - (y as NcDimension, x as NcDimension) + (y as NcDim, x as NcDim) ] } @@ -401,23 +401,23 @@ impl NcDirect { /// Gets the current number of rows. /// /// *C style function: [ncdirect_dim_y()][crate::ncdirect_dim_y].* - pub fn dim_y(&self) -> NcDimension { - unsafe { crate::ncdirect_dim_y(self) as NcDimension } + pub fn dim_y(&self) -> NcDim { + unsafe { crate::ncdirect_dim_y(self) as NcDim } } /// Gets the current number of columns. /// /// *C style function: [ncdirect_dim_x()][crate::ncdirect_dim_x].* - pub fn dim_x(&self) -> NcDimension { - unsafe { crate::ncdirect_dim_x(self) as NcDimension } + pub fn dim_x(&self) -> NcDim { + unsafe { crate::ncdirect_dim_x(self) as NcDim } } /// Gets the current number of rows and columns. /// /// *C style function: [ncdirect_dim_y()][crate::ncdirect_dim_y].* - pub fn dim_yx(&self) -> (NcDimension, NcDimension) { - let y = unsafe { crate::ncdirect_dim_y(self) as NcDimension }; - let x = unsafe { crate::ncdirect_dim_x(self) as NcDimension }; + pub fn dim_yx(&self) -> (NcDim, NcDim) { + let y = unsafe { crate::ncdirect_dim_y(self) as NcDim }; + let x = unsafe { crate::ncdirect_dim_x(self) as NcDim }; (y, x) } } @@ -534,8 +534,8 @@ impl NcDirect { ll: NcChannelPair, lr: NcChannelPair, wchars: &[char; 6], - y_len: NcDimension, - x_len: NcDimension, + y_len: NcDim, + x_len: NcDim, ctlword: u32, ) -> NcResult<()> { error![ @@ -569,8 +569,8 @@ impl NcDirect { ur: NcChannelPair, ll: NcChannelPair, lr: NcChannelPair, - y_len: NcDimension, - x_len: NcDimension, + y_len: NcDim, + x_len: NcDim, ctlword: u32, ) -> NcResult<()> { error![unsafe { @@ -587,8 +587,8 @@ impl NcDirect { ur: NcChannelPair, ll: NcChannelPair, lr: NcChannelPair, - y_len: NcDimension, - x_len: NcDimension, + y_len: NcDim, + x_len: NcDim, ctlword: u32, ) -> NcResult<()> { error![unsafe { @@ -610,7 +610,7 @@ impl NcDirect { pub fn hline_interp( &mut self, egc: &NcEgc, - len: NcDimension, + len: NcDim, h1: NcChannelPair, h2: NcChannelPair, ) -> NcResult<()> { @@ -632,7 +632,7 @@ impl NcDirect { pub fn vline_interp( &mut self, egc: &NcEgc, - len: NcDimension, + len: NcDim, h1: NcChannelPair, h2: NcChannelPair, ) -> NcResult<()> { diff --git a/rust/src/direct/wrapper.rs b/rust/src/direct/wrapper.rs index cca6b7ed6..03c4d0004 100644 --- a/rust/src/direct/wrapper.rs +++ b/rust/src/direct/wrapper.rs @@ -2,9 +2,7 @@ use std::ops::{Deref, DerefMut}; -use crate::{ - raw_wrap, NcDirect, NcResult -}; +use crate::{raw_wrap, NcDirect, NcResult}; /// Safe wrapper around [NcDirect], minimal notcurses instance for styling text. pub struct DirectMode<'a> { diff --git a/rust/src/fade.rs b/rust/src/fade.rs index 02e92be3c..c79613425 100644 --- a/rust/src/fade.rs +++ b/rust/src/fade.rs @@ -11,7 +11,7 @@ use std::ffi::c_void; -use crate::{NcIntResult, Notcurses, NcPlane, NcTime}; +use crate::{NcIntResult, NcPlane, NcTime, Notcurses}; /// Called for each fade iteration on the NcPlane. /// diff --git a/rust/src/input/mod.rs b/rust/src/input/mod.rs index 8b81810d3..7fcb6cc60 100644 --- a/rust/src/input/mod.rs +++ b/rust/src/input/mod.rs @@ -9,7 +9,7 @@ // + nckey_mouse_p // + nckey_supppuab_p -use crate::NcDimension; +use crate::NcDim; mod keycodes; pub use keycodes::*; @@ -88,8 +88,8 @@ impl NcInput { /// New NcInput, expecting all the arguments. pub const fn with_all_args( id: char, - x: Option, - y: Option, + x: Option, + y: Option, alt: bool, shift: bool, ctrl: bool, diff --git a/rust/src/macros.rs b/rust/src/macros.rs index 3ed10cfc8..712d77a62 100644 --- a/rust/src/macros.rs +++ b/rust/src/macros.rs @@ -5,7 +5,7 @@ #[allow(unused_imports)] // enjoy briefer doc comments -use crate::{NcDirect, NcError, Notcurses, NcResult, NCRESULT_ERR, NCRESULT_OK}; +use crate::{NcDirect, NcError, NcResult, Notcurses, NCRESULT_ERR, NCRESULT_OK}; // Sleep, Render & Flush Macros ------------------------------------------------ diff --git a/rust/src/notcurses/methods.rs b/rust/src/notcurses/methods.rs index a7db95c40..2bc42a7ab 100644 --- a/rust/src/notcurses/methods.rs +++ b/rust/src/notcurses/methods.rs @@ -4,9 +4,9 @@ use core::ptr::{null, null_mut}; use crate::{ cstring, error, error_ref_mut, notcurses_init, rstring, NcAlign, NcBlitter, NcChannelPair, - NcDimension, NcEgc, NcError, NcFile, NcInput, NcLogLevel, Notcurses, NotcursesOptions, - NcPlane, NcResult, NcScale, NcSignalSet, NcStats, NcStyleMask, NcTime, - NCOPTION_NO_ALTERNATE_SCREEN, NCOPTION_SUPPRESS_BANNERS, NCRESULT_ERR, + NcDim, NcEgc, NcError, NcFile, NcInput, NcLogLevel, NcPlane, NcResult, NcScale, NcSignalSet, + NcStats, NcStyleMask, NcTime, Notcurses, NotcursesOptions, NCOPTION_NO_ALTERNATE_SCREEN, + NCOPTION_SUPPRESS_BANNERS, NCRESULT_ERR, }; /// # `NotcursesOptions` Constructors @@ -17,12 +17,7 @@ impl NotcursesOptions { } /// New NotcursesOptions, with margins. - pub const fn with_margins( - top: NcDimension, - right: NcDimension, - bottom: NcDimension, - left: NcDimension, - ) -> Self { + pub const fn with_margins(top: NcDim, right: NcDim, bottom: NcDim, left: NcDim) -> Self { Self::with_all_options(0, top, right, bottom, left, 0) } @@ -64,10 +59,10 @@ impl NotcursesOptions { /// pub const fn with_all_options( loglevel: NcLogLevel, - margin_t: NcDimension, - margin_r: NcDimension, - margin_b: NcDimension, - margin_l: NcDimension, + margin_t: NcDim, + margin_r: NcDim, + margin_b: NcDim, + margin_l: NcDim, flags: u64, ) -> Self { Self { @@ -132,7 +127,7 @@ impl Notcurses { /// *C style function: [notcurses_align()][crate::notcurses_align].* // // TODO: handle error rightfully. - pub fn align(availcols: NcDimension, align: NcAlign, cols: NcDimension) -> NcResult<()> { + pub fn align(availcols: NcDim, align: NcAlign, cols: NcDim) -> NcResult<()> { error![crate::notcurses_align(availcols, align, cols)] } @@ -145,8 +140,8 @@ impl Notcurses { /// *C style function: [notcurses_at_yx()][crate::notcurses_at_yx].* pub fn at_yx( &mut self, - y: NcDimension, - x: NcDimension, + y: NcDim, + x: NcDim, stylemask: &mut NcStyleMask, channels: &mut NcChannelPair, ) -> Option { @@ -249,7 +244,7 @@ impl Notcurses { /// It is an error if `y`, `x` lies outside the standard plane. /// /// *C style function: [notcurses_cursor_enable()][crate::notcurses_cursor_enable].* - pub fn cursor_enable(&mut self, y: NcDimension, x: NcDimension) -> NcResult<()> { + pub fn cursor_enable(&mut self, y: NcDim, x: NcDim) -> NcResult<()> { error![unsafe { crate::notcurses_cursor_enable(self, y as i32, x as i32) }] } @@ -463,12 +458,12 @@ impl Notcurses { /// /// *C style function: [notcurses_refresh()][crate::notcurses_refresh].* // - pub fn refresh(&mut self) -> NcResult<(NcDimension, NcDimension)> { + pub fn refresh(&mut self) -> NcResult<(NcDim, NcDim)> { let (mut y, mut x) = (0, 0); error![ unsafe { crate::notcurses_refresh(self, &mut y, &mut x) }, "", - (y as NcDimension, x as NcDimension) + (y as NcDim, x as NcDim) ] } @@ -547,8 +542,8 @@ impl Notcurses { // #[inline] // pub fn stddim_yx<'a>( // &'a mut self, - // y: &mut NcDimension, - // x: &mut NcDimension, + // y: &mut NcDim, + // x: &mut NcDim, // ) -> NcResult<&'a mut NcPlane> { // crate::notcurses_stddim_yx(self, y, x) // } @@ -560,8 +555,8 @@ impl Notcurses { // #[inline] // pub fn stddim_yx_const<'a>( // &'a self, - // y: &mut NcDimension, - // x: &mut NcDimension, + // y: &mut NcDim, + // x: &mut NcDim, // ) -> NcResult<&'a NcPlane> { // crate::notcurses_stddim_yx_const(self, y, x) // } @@ -573,7 +568,7 @@ impl Notcurses { /// /// *C style function: [notcurses_stdplane()][crate::notcurses_stdplane].* pub fn stdplane<'a>(&mut self) -> &'a mut NcPlane { - unsafe { &mut *crate::notcurses_stdplane(self) } + unsafe { &mut *crate::notcurses_stdplane(self) } } /// Returns a reference to the standard [NcPlane] for this terminal. @@ -622,7 +617,7 @@ impl Notcurses { /// Returns our current idea of the terminal dimensions in rows and cols. /// /// *C style function: [notcurses_supported_styles()][crate::notcurses_supported_styles].* - pub fn term_dim_yx(&self) -> (NcDimension, NcDimension) { + pub fn term_dim_yx(&self) -> (NcDim, NcDim) { crate::notcurses_term_dim_yx(self) } diff --git a/rust/src/notcurses/reimplemented.rs b/rust/src/notcurses/reimplemented.rs index 79c547adc..add60d479 100644 --- a/rust/src/notcurses/reimplemented.rs +++ b/rust/src/notcurses/reimplemented.rs @@ -3,8 +3,8 @@ use core::ptr::{null, null_mut}; use crate::{ - NcAlign, NcDimension, NcError, NcInput, Notcurses, NcOffset, NcPlane, NcResult, NcSignalSet, - NcTime, NCALIGN_CENTER, NCALIGN_LEFT, NCALIGN_RIGHT, NCRESULT_ERR, NCRESULT_MAX, + NcAlign, NcDim, NcError, NcInput, NcOffset, NcPlane, NcResult, NcSignalSet, NcTime, Notcurses, + NCALIGN_CENTER, NCALIGN_LEFT, NCALIGN_RIGHT, NCRESULT_ERR, NCRESULT_MAX, }; /// Returns the offset into `availcols` at which `cols` ought be output given @@ -15,7 +15,7 @@ use crate::{ /// /// *Method: Notcurses.[align()][Notcurses#method.align].* #[inline] -pub fn notcurses_align(availcols: NcDimension, align: NcAlign, cols: NcDimension) -> NcOffset { +pub fn notcurses_align(availcols: NcDim, align: NcAlign, cols: NcDim) -> NcOffset { if align == NCALIGN_LEFT { return 0; } @@ -79,8 +79,8 @@ pub fn notcurses_getc_blocking(nc: &mut Notcurses, input: Option<&mut NcInput>) #[inline] pub fn notcurses_stddim_yx<'a>( nc: &'a mut Notcurses, - y: &mut NcDimension, - x: &mut NcDimension, + y: &mut NcDim, + x: &mut NcDim, ) -> NcResult<&'a mut NcPlane> { unsafe { let sp = crate::notcurses_stdplane(nc); @@ -99,8 +99,8 @@ pub fn notcurses_stddim_yx<'a>( #[inline] pub fn notcurses_stddim_yx_const<'a>( nc: &'a Notcurses, - y: &mut NcDimension, - x: &mut NcDimension, + y: &mut NcDim, + x: &mut NcDim, ) -> NcResult<&'a NcPlane> { unsafe { let sp = crate::notcurses_stdplane_const(nc); @@ -116,10 +116,10 @@ pub fn notcurses_stddim_yx_const<'a>( /// /// *Method: Notcurses.[getc_term_yx()][Notcurses#method.term_yx].* #[inline] -pub fn notcurses_term_dim_yx(nc: &Notcurses) -> (NcDimension, NcDimension) { +pub fn notcurses_term_dim_yx(nc: &Notcurses) -> (NcDim, NcDim) { let (mut y, mut x) = (0, 0); unsafe { crate::ncplane_dim_yx(crate::notcurses_stdplane_const(nc), &mut y, &mut x); } - (y as NcDimension, x as NcDimension) + (y as NcDim, x as NcDim) } diff --git a/rust/src/notcurses/wrapper.rs b/rust/src/notcurses/wrapper.rs index 521fda242..52138da69 100644 --- a/rust/src/notcurses/wrapper.rs +++ b/rust/src/notcurses/wrapper.rs @@ -3,8 +3,7 @@ use std::ops::{Deref, DerefMut}; use crate::{ - raw_wrap, NcAlign, NcBlitter, NcDimension, NcLogLevel, Notcurses, NotcursesOptions, - NcResult, NcScale, + raw_wrap, NcAlign, NcBlitter, NcDim, NcLogLevel, NcResult, NcScale, Notcurses, NotcursesOptions, }; /// Safe wrapper around [Notcurses], the main struct of the TUI library. @@ -91,7 +90,7 @@ impl<'a> FullMode<'a> { /// Returns the offset into `availcols` at which `cols` ought be output given /// the requirements of `align`. - pub fn align(availcols: NcDimension, align: NcAlign, cols: NcDimension) -> NcResult<()> { + pub fn align(availcols: NcDim, align: NcAlign, cols: NcDim) -> NcResult<()> { Notcurses::align(availcols, align, cols) } diff --git a/rust/src/palette/methods.rs b/rust/src/palette/methods.rs index 552cee743..4c4b94337 100644 --- a/rust/src/palette/methods.rs +++ b/rust/src/palette/methods.rs @@ -1,6 +1,6 @@ //! `NcPalette` methods and associated functions. -use crate::{error, NcChannel, NcColor, Notcurses, NcPalette, NcPaletteIndex, NcResult, NcRgb}; +use crate::{error, NcChannel, NcColor, NcPalette, NcPaletteIndex, NcResult, NcRgb, Notcurses}; impl NcPalette { /// New NcPalette. diff --git a/rust/src/plane/helpers.rs b/rust/src/plane/helpers.rs index 9ff29fb46..4531edc8d 100644 --- a/rust/src/plane/helpers.rs +++ b/rust/src/plane/helpers.rs @@ -1,4 +1,4 @@ -use crate::{NcDimension, Notcurses, NcOffset, NcPlane, NcPlaneOptions}; +use crate::{NcDim, NcOffset, NcPlane, NcPlaneOptions, Notcurses}; /// Helper function for a new NcPlane on C style tests. #[allow(dead_code)] @@ -6,8 +6,8 @@ pub(crate) unsafe fn ncplane_new_test<'a>( nc: &mut Notcurses, y: NcOffset, x: NcOffset, - rows: NcDimension, - cols: NcDimension, + rows: NcDim, + cols: NcDim, ) -> &'a mut NcPlane { &mut *crate::ncpile_create(nc, &NcPlaneOptions::new(y, x, rows, cols)) } @@ -18,8 +18,8 @@ pub(crate) unsafe fn ncplane_new_bound_test<'a>( plane: &mut NcPlane, y: NcOffset, x: NcOffset, - rows: NcDimension, - cols: NcDimension, + rows: NcDim, + cols: NcDim, ) -> &'a mut NcPlane { &mut *crate::ncplane_create(plane, &NcPlaneOptions::new(y, x, rows, cols)) } diff --git a/rust/src/plane/methods.rs b/rust/src/plane/methods.rs index 7a5ff31c9..7e5559b5d 100644 --- a/rust/src/plane/methods.rs +++ b/rust/src/plane/methods.rs @@ -4,20 +4,20 @@ use core::ptr::{null, null_mut}; use crate::{ cstring, error, error_ref, error_ref_mut, rstring, NcAlign, NcAlphaBits, NcBoxMask, NcCell, - NcChannel, NcChannelPair, NcColor, NcDimension, NcEgc, NcError, NcFadeCb, Notcurses, - NcOffset, NcPaletteIndex, NcPlane, NcPlaneOptions, NcResizeCb, NcResult, NcRgb, NcStyleMask, - NcTime, NCRESULT_ERR, + NcChannel, NcChannelPair, NcColor, NcDim, NcEgc, NcError, NcFadeCb, NcOffset, NcPaletteIndex, + NcPlane, NcPlaneOptions, NcResizeCb, NcResult, NcRgb, NcStyleMask, NcTime, Notcurses, + NCRESULT_ERR, }; /// # NcPlaneOptions Constructors impl NcPlaneOptions { /// New NcPlaneOptions using the horizontal x. - pub fn new(y: NcOffset, x: NcOffset, rows: NcDimension, cols: NcDimension) -> Self { + pub fn new(y: NcOffset, x: NcOffset, rows: NcDim, cols: NcDim) -> Self { Self::with_flags(y, x, rows, cols, None, 0) } /// New NcPlaneOptions with horizontal alignment. - pub fn new_aligned(y: NcOffset, align: NcAlign, rows: NcDimension, cols: NcDimension) -> Self { + pub fn new_aligned(y: NcOffset, align: NcAlign, rows: NcDim, cols: NcDim) -> Self { Self::with_flags_aligned(y, align, rows, cols, None, crate::NCPLANE_OPTION_HORALIGNED) } @@ -25,8 +25,8 @@ impl NcPlaneOptions { pub fn with_flags( y: NcOffset, x: NcOffset, - rows: NcDimension, - cols: NcDimension, + rows: NcDim, + cols: NcDim, resizecb: Option, flags: u64, ) -> Self { @@ -49,8 +49,8 @@ impl NcPlaneOptions { pub fn with_flags_aligned( y: NcOffset, align: NcAlign, - rows: NcDimension, - cols: NcDimension, + rows: NcDim, + cols: NcDim, resizecb: Option, flags: u64, ) -> Self { @@ -79,8 +79,8 @@ impl NcPlane { nc: &mut Notcurses, y: NcOffset, x: NcOffset, - rows: NcDimension, - cols: NcDimension, + rows: NcDim, + cols: NcDim, ) -> NcResult<&'a mut NcPlane> { Self::with_options(nc, NcPlaneOptions::new(y, x, rows, cols)) } @@ -107,8 +107,8 @@ impl NcPlane { bound_to: &mut NcPlane, y: NcOffset, x: NcOffset, - rows: NcDimension, - cols: NcDimension, + rows: NcDim, + cols: NcDim, ) -> NcResult<&'a mut NcPlane> { Self::with_options_bound(bound_to, NcPlaneOptions::new(y, x, rows, cols)) } @@ -136,7 +136,7 @@ impl NcPlane { assert![(trows > 0) & (tcols > 0)]; Self::with_options( nc, - NcPlaneOptions::new(0, 0, trows as NcDimension, tcols as NcDimension), + NcPlaneOptions::new(0, 0, trows as NcDim, tcols as NcDim), ) } @@ -248,8 +248,8 @@ impl NcPlane { /// *C style function: [ncplane_stain()][crate::ncplane_stain].* pub fn stain( &mut self, - y_stop: NcDimension, - x_stop: NcDimension, + y_stop: NcDim, + x_stop: NcDim, ul: NcChannelPair, ur: NcChannelPair, ll: NcChannelPair, @@ -419,10 +419,10 @@ impl NcPlane { /// *C style function: [ncplane_format()][crate::ncplane_format].* pub fn format( &mut self, - y_stop: NcDimension, - x_stop: NcDimension, + y_stop: NcDim, + x_stop: NcDim, stylemask: NcStyleMask, - ) -> NcResult { + ) -> NcResult { let res = unsafe { crate::ncplane_format(self, y_stop as i32, x_stop as i32, stylemask as u32) }; error![ @@ -540,8 +540,8 @@ impl NcPlane { /// *C style function: [ncplane_at_yx()][crate::ncplane_at_yx].* pub fn at_yx( &mut self, - y: NcDimension, - x: NcDimension, + y: NcDim, + x: NcDim, stylemask: &mut NcStyleMask, channels: &mut NcChannelPair, ) -> NcResult { @@ -566,12 +566,7 @@ impl NcPlane { /// /// *C style function: [ncplane_at_yx_cell()][crate::ncplane_at_yx_cell].* #[inline] - pub fn ncplane_at_yx_cell( - &mut self, - y: NcDimension, - x: NcDimension, - cell: &mut NcCell, - ) -> NcResult { + pub fn ncplane_at_yx_cell(&mut self, y: NcDim, x: NcDim, cell: &mut NcCell) -> NcResult { let bytes = unsafe { crate::ncplane_at_yx_cell(self, y as i32, x as i32, cell) }; error![ bytes, @@ -651,10 +646,10 @@ impl NcPlane { /// *C style function: [ncplane_contents()][crate::ncplane_contents].* pub fn contents( &self, - beg_y: NcDimension, - beg_x: NcDimension, - len_y: NcDimension, - len_x: NcDimension, + beg_y: NcDim, + beg_x: NcDim, + len_y: NcDim, + len_x: NcDim, through_y: bool, through_x: bool, ) -> String { @@ -695,17 +690,12 @@ impl NcPlane { /// On success, returns the number of columns the cursor was advanced. /// /// *C style function: [ncplane_putc_yx()][crate::ncplane_putc_yx].* - pub fn putc_yx( - &mut self, - y: NcDimension, - x: NcDimension, - cell: &NcCell, - ) -> NcResult { + pub fn putc_yx(&mut self, y: NcDim, x: NcDim, cell: &NcCell) -> NcResult { let res = unsafe { crate::ncplane_putc_yx(self, y as i32, x as i32, cell) }; error![ res, &format!("NcPlane.putc_yx({}, {}, {:?})", y, x, cell), - res as NcDimension + res as NcDim ] } @@ -716,13 +706,9 @@ impl NcPlane { /// On success, returns the number of columns the cursor was advanced. /// /// *C style function: [ncplane_putc()][crate::ncplane_putc].* - pub fn putc(&mut self, cell: &NcCell) -> NcResult { + pub fn putc(&mut self, cell: &NcCell) -> NcResult { let res = crate::ncplane_putc(self, cell); - error![ - res, - &format!("NcPlane.putc({:?})", cell), - res as NcDimension - ] + error![res, &format!("NcPlane.putc({:?})", cell), res as NcDim] } /// Calls [putchar_yx][NcPlane#method.putchar_yx] at the current cursor location. @@ -730,20 +716,16 @@ impl NcPlane { /// On success, returns the number of columns the cursor was advanced. /// /// *C style function: [ncplane_putchar()][crate::ncplane_putchar].* - pub fn putchar(&mut self, ch: char) -> NcResult { + pub fn putchar(&mut self, ch: char) -> NcResult { let res = crate::ncplane_putchar(self, ch); - error![ - res, - &format!("NcPlane.putchar({:?})", ch), - res as NcDimension - ] + error![res, &format!("NcPlane.putchar({:?})", ch), res as NcDim] } // TODO: call put_egc // /// Replaces the [NcEgc][crate::NcEgc] to the current location, but retain // /// the styling. The current styling of the plane will not be changed. - // pub fn putchar_stained(&mut self, y: NcDimension, x: NcDimension, ch: char) -> - // NcResult { + // pub fn putchar_stained(&mut self, y: NcDim, x: NcDim, ch: char) -> + // NcResult { // error![crate::ncplane_putchar_stained(self, ch)] // } @@ -753,17 +735,12 @@ impl NcPlane { /// On success, returns the number of columns the cursor was advanced. /// /// *C style function: [ncplane_putchar_yx()][crate::ncplane_putchar_yx].* - pub fn putchar_yx( - &mut self, - y: NcDimension, - x: NcDimension, - ch: char, - ) -> NcResult { + pub fn putchar_yx(&mut self, y: NcDim, x: NcDim, ch: char) -> NcResult { let res = crate::ncplane_putchar_yx(self, y, x, ch); error![ res, &format!("NcPlane.putchar_yx({}, {}, {:?})", y, x, ch), - res as NcDimension + res as NcDim ] } @@ -779,13 +756,9 @@ impl NcPlane { /// /// *C style function: [ncplane_putstr()][crate::ncplane_putstr].* #[inline] - pub fn putstr(&mut self, string: &str) -> NcResult { + pub fn putstr(&mut self, string: &str) -> NcResult { let res = crate::ncplane_putstr(self, string); - error![ - res, - &format!("NcPlane.putstr({:?})", string), - res as NcDimension - ] + error![res, &format!("NcPlane.putstr({:?})", string), res as NcDim] } /// Same as [putstr][NcPlane#method.putstr], but it also tries to move the @@ -798,7 +771,7 @@ impl NcPlane { /// columns which were written before the error. /// /// *(No equivalent C style function)* - pub fn putstrln(&mut self, string: &str) -> NcResult { + pub fn putstrln(&mut self, string: &str) -> NcResult { let cols = self.putstr(string)?; let (y, _x) = self.cursor_yx(); self.cursor_move_yx(y + 1, 0)?; @@ -808,17 +781,12 @@ impl NcPlane { /// Same as [putstr_yx()][NcPlane#method.putstr_yx] but [NcAlign]ed on x. /// /// *C style function: [ncplane_putstr_aligned()][crate::ncplane_putstr_aligned].* - pub fn putstr_aligned( - &mut self, - y: NcDimension, - align: NcAlign, - string: &str, - ) -> NcResult { + pub fn putstr_aligned(&mut self, y: NcDim, align: NcAlign, string: &str) -> NcResult { let res = unsafe { crate::ncplane_putstr_aligned(self, y as i32, align, cstring![string]) }; error![ res, &format!("NcPlane.putstr_aligned({}, {}, {:?})", y, align, string), - res as NcDimension + res as NcDim ] } @@ -833,12 +801,12 @@ impl NcPlane { /// columns which were written before the error. /// /// *C style function: [ncplane_putstr_stained()][crate::ncplane_putstr_stained].* - pub fn putstr_stained(&mut self, string: &str) -> NcResult { + pub fn putstr_stained(&mut self, string: &str) -> NcResult { let res = unsafe { crate::ncplane_putstr_stained(self, cstring![string]) }; error![ res, &format!("NcPlane.putstr_stained({:?})", string), - res as NcDimension + res as NcDim ] } @@ -854,17 +822,12 @@ impl NcPlane { /// columns which were written before the error. /// /// *C style function: [ncplane_putstr_yx()][crate::ncplane_putstr_yx].* - pub fn putstr_yx( - &mut self, - y: NcDimension, - x: NcDimension, - string: &str, - ) -> NcResult { + pub fn putstr_yx(&mut self, y: NcDim, x: NcDim, string: &str) -> NcResult { let res = unsafe { crate::ncplane_putstr_yx(self, y as i32, x as i32, cstring![string]) }; error![ res, &format!("NcPlane.putstr_yx({}, {}, {:?})", y, x, string), - res as NcDimension + res as NcDim ] } } @@ -991,12 +954,12 @@ impl NcPlane { pub fn mergedown( &mut self, source: &NcPlane, - source_y: NcDimension, - source_x: NcDimension, - len_y: NcDimension, - len_x: NcDimension, - target_y: NcDimension, - target_x: NcDimension, + source_y: NcDim, + source_x: NcDim, + len_y: NcDim, + len_x: NcDim, + target_y: NcDim, + target_x: NcDim, ) -> NcResult<()> { error![ unsafe { @@ -1154,23 +1117,23 @@ impl NcPlane { // // NOTE: y and/or x may be NULL. // check for null and return NcResult - pub fn cursor_yx(&self) -> (NcDimension, NcDimension) { + pub fn cursor_yx(&self) -> (NcDim, NcDim) { let (mut y, mut x) = (0, 0); unsafe { crate::ncplane_cursor_yx(self, &mut y, &mut x) }; - (y as NcDimension, x as NcDimension) + (y as NcDim, x as NcDim) } /// Returns the current row of the cursor within this NcPlane. /// /// *(No equivalent C style function)* - pub fn cursor_y(&self) -> NcDimension { + pub fn cursor_y(&self) -> NcDim { self.cursor_yx().0 } /// Returns the current column of the cursor within this NcPlane. /// /// *(No equivalent C style function)* - pub fn cursor_x(&self) -> NcDimension { + pub fn cursor_x(&self) -> NcDim { self.cursor_yx().1 } @@ -1182,7 +1145,7 @@ impl NcPlane { /// and the cursor position will remain unchanged. /// /// *C style function: [ncplane_cursor_move_yx()][crate::ncplane_cursor_move_yx].* - pub fn cursor_move_yx(&mut self, y: NcDimension, x: NcDimension) -> NcResult<()> { + pub fn cursor_move_yx(&mut self, y: NcDim, x: NcDim) -> NcResult<()> { error![ unsafe { crate::ncplane_cursor_move_yx(self, y as i32, x as i32) }, &format!("NcPlane.move_yx({}, {})", y, x) @@ -1192,7 +1155,7 @@ impl NcPlane { /// Moves the cursor to the specified row within this NcPlane. /// /// *(No equivalent C style function)* - pub fn cursor_move_y(&mut self, y: NcDimension) -> NcResult<()> { + pub fn cursor_move_y(&mut self, y: NcDim) -> NcResult<()> { let x = self.cursor_x(); error![ unsafe { crate::ncplane_cursor_move_yx(self, y as i32, x as i32) }, @@ -1203,7 +1166,7 @@ impl NcPlane { /// Moves the cursor to the specified column within this NcPlane. /// /// *(No equivalent C style function)* - pub fn cursor_move_x(&mut self, x: NcDimension) -> NcResult<()> { + pub fn cursor_move_x(&mut self, x: NcDim) -> NcResult<()> { let y = self.cursor_y(); error![ unsafe { crate::ncplane_cursor_move_yx(self, y as i32, x as i32) }, @@ -1218,7 +1181,7 @@ impl NcPlane { /// *(No equivalent C style function)* pub fn cursor_move_rows(&mut self, rows: NcOffset) -> NcResult<()> { let (y, x) = self.cursor_yx(); - self.cursor_move_yx((y as NcOffset + rows) as NcDimension, x) + self.cursor_move_yx((y as NcOffset + rows) as NcDim, x) } /// Moves the cursor the number of columns specified (forward or backwards). @@ -1228,7 +1191,7 @@ impl NcPlane { /// *(No equivalent C style function)* pub fn cursor_move_cols(&mut self, cols: NcOffset) -> NcResult<()> { let (y, x) = self.cursor_yx(); - self.cursor_move_yx(y, (x as NcOffset + cols) as NcDimension) + self.cursor_move_yx(y, (x as NcOffset + cols) as NcDim) } } @@ -1243,7 +1206,7 @@ impl NcPlane { /// /// *C style function: [ncplane_align()][crate::ncplane_align].* #[inline] - pub fn align(&mut self, align: NcAlign, cols: NcDimension) -> NcResult<()> { + pub fn align(&mut self, align: NcAlign, cols: NcDim) -> NcResult<()> { error![ crate::ncplane_align(self, align, cols), &format!("NcPlane.align({:?}, {})", align, cols) @@ -1255,7 +1218,7 @@ impl NcPlane { /// *C style function: [ncplane_center_abs()][crate::ncplane_center_abs].* // // TODO: doc. - pub fn center_abs(&self, y: &mut NcDimension, x: &mut NcDimension) { + pub fn center_abs(&self, y: &mut NcDim, x: &mut NcDim) { unsafe { crate::ncplane_center_abs(self, &mut (*y as i32), &mut (*x as i32)); } @@ -1264,17 +1227,17 @@ impl NcPlane { /// Returns the dimensions of this NcPlane. /// /// *C style function: [ncplane_dim_yx()][crate::ncplane_dim_yx].* - pub fn dim_yx(&self) -> (NcDimension, NcDimension) { + pub fn dim_yx(&self) -> (NcDim, NcDim) { let (mut y, mut x) = (0, 0); unsafe { crate::ncplane_dim_yx(self, &mut y, &mut x) }; - (y as NcDimension, x as NcDimension) + (y as NcDim, x as NcDim) } /// Return the rows of this NcPlane. /// /// *C style function: [ncplane_dim_y()][crate::ncplane_dim_y].* #[inline] - pub fn dim_y(&self) -> NcDimension { + pub fn dim_y(&self) -> NcDim { self.dim_yx().0 } @@ -1282,7 +1245,7 @@ impl NcPlane { /// /// *C style function: [ncplane_dim_x()][crate::ncplane_dim_x].* #[inline] - pub fn dim_x(&self) -> NcDimension { + pub fn dim_x(&self) -> NcDim { self.dim_yx().1 } @@ -1292,7 +1255,7 @@ impl NcPlane { /// /// *C style function: [ncplane_dim_y()][crate::ncplane_dim_y].* #[inline] - pub fn rows(&self) -> NcDimension { + pub fn rows(&self) -> NcDim { self.dim_yx().0 } @@ -1302,7 +1265,7 @@ impl NcPlane { /// /// *C style function: [ncplane_dim_x()][crate::ncplane_dim_x].* #[inline] - pub fn cols(&self) -> NcDimension { + pub fn cols(&self) -> NcDim { self.dim_yx().1 } @@ -1328,14 +1291,14 @@ impl NcPlane { /// *C style function: [ncplane_resize()][crate::ncplane_resize].* pub fn resize( &mut self, - keep_y: NcDimension, - keep_x: NcDimension, - keep_len_y: NcDimension, - keep_len_x: NcDimension, + keep_y: NcDim, + keep_x: NcDim, + keep_len_y: NcDim, + keep_len_x: NcDim, y_off: NcOffset, x_off: NcOffset, - y_len: NcDimension, - x_len: NcDimension, + y_len: NcDim, + x_len: NcDim, ) -> NcResult<()> { error![ unsafe { @@ -1375,7 +1338,7 @@ impl NcPlane { /// /// *C style function: [ncplane_resize_simple()][crate::ncplane_resize_simple].* #[inline] - pub fn resize_simple(&mut self, y_len: NcDimension, x_len: NcDimension) -> NcResult<()> { + pub fn resize_simple(&mut self, y_len: NcDim, x_len: NcDim) -> NcResult<()> { error![crate::ncplane_resize_simple( self, y_len as u32, @@ -1432,7 +1395,7 @@ impl NcPlane { /// *C style function: [ncplane_translate()][crate::ncplane_translate].* // // TODO: API change, return the coordinates as a tuple instead of being &mut - pub fn translate(&self, target: &NcPlane, y: &mut NcDimension, x: &mut NcDimension) { + pub fn translate(&self, target: &NcPlane, y: &mut NcDim, x: &mut NcDim) { unsafe { crate::ncplane_translate(self, target, &mut (*y as i32), &mut (*x as i32)) } } @@ -1444,7 +1407,7 @@ impl NcPlane { /// *C style function: [ncplane_translate_abs()][crate::ncplane_translate_abs].* // // TODO: API change, return a tuple (y,x,bool) - pub fn translate_abs(&self, y: &mut NcDimension, x: &mut NcDimension) -> bool { + pub fn translate_abs(&self, y: &mut NcDim, x: &mut NcDim) -> bool { unsafe { crate::ncplane_translate_abs(self, &mut (*y as i32), &mut (*x as i32)) } } @@ -1520,8 +1483,8 @@ impl NcPlane { lr: &NcCell, hline: &NcCell, vline: &NcCell, - y_stop: NcDimension, - x_stop: NcDimension, + y_stop: NcDim, + x_stop: NcDim, boxmask: NcBoxMask, ) -> NcResult<()> { error![unsafe { @@ -1556,8 +1519,8 @@ impl NcPlane { lr: &NcCell, hline: &NcCell, vline: &NcCell, - y_len: NcDimension, - x_len: NcDimension, + y_len: NcDim, + x_len: NcDim, boxmask: NcBoxMask, ) -> NcResult<()> { error![crate::ncplane_box_sized( @@ -1573,8 +1536,8 @@ impl NcPlane { &mut self, stylemask: NcStyleMask, channels: NcChannelPair, - y_stop: NcDimension, - x_stop: NcDimension, + y_stop: NcDim, + x_stop: NcDim, boxmask: NcBoxMask, ) -> NcResult<()> { error![crate::ncplane_double_box( @@ -1590,8 +1553,8 @@ impl NcPlane { &mut self, stylemask: NcStyleMask, channels: NcChannelPair, - y_len: NcDimension, - x_len: NcDimension, + y_len: NcDim, + x_len: NcDim, boxmask: NcBoxMask, ) -> NcResult<()> { error![crate::ncplane_double_box( @@ -1748,9 +1711,9 @@ impl NcPlane { ur: NcChannelPair, ll: NcChannelPair, lr: NcChannelPair, - y_stop: NcDimension, - x_stop: NcDimension, - ) -> NcResult { + y_stop: NcDim, + x_stop: NcDim, + ) -> NcResult { let res = unsafe { crate::ncplane_gradient( self, @@ -1764,7 +1727,7 @@ impl NcPlane { x_stop as i32, ) }; - error![res, "", res as NcDimension] + error![res, "", res as NcDim] } /// Draw a gradient with its upper-left corner at the current cursor position, @@ -1782,11 +1745,11 @@ impl NcPlane { ur: NcChannel, ll: NcChannel, lr: NcChannel, - y_len: NcDimension, - x_len: NcDimension, - ) -> NcResult { + y_len: NcDim, + x_len: NcDim, + ) -> NcResult { let res = crate::ncplane_gradient_sized(self, egc, stylemask, ul, ur, ll, lr, y_len, x_len); - error![res, "", res as NcDimension] + error![res, "", res as NcDim] } /// Draws a high-resolution gradient using upper blocks and synced backgrounds. @@ -1804,13 +1767,13 @@ impl NcPlane { ur: NcChannel, ll: NcChannel, lr: NcChannel, - y_stop: NcDimension, - x_stop: NcDimension, - ) -> NcResult { + y_stop: NcDim, + x_stop: NcDim, + ) -> NcResult { let res = unsafe { crate::ncplane_highgradient(self, ul, ur, ll, lr, y_stop as i32, x_stop as i32) }; - error![res, "", res as NcDimension] + error![res, "", res as NcDim] } /// [`gradient_sized`][NcPlane#method.gradient_sized] @@ -1823,13 +1786,13 @@ impl NcPlane { ur: NcChannel, ll: NcChannel, lr: NcChannel, - y_stop: NcDimension, - x_stop: NcDimension, - ) -> NcResult { + y_stop: NcDim, + x_stop: NcDim, + ) -> NcResult { let res = unsafe { crate::ncplane_highgradient_sized(self, ul, ur, ll, lr, y_stop as i32, x_stop as i32) }; - error![res, "", res as NcDimension] + error![res, "", res as NcDim] } /// Converts this NcPlane's content to greyscale. diff --git a/rust/src/plane/reimplemented.rs b/rust/src/plane/reimplemented.rs index 3f1fc40eb..74403c40a 100644 --- a/rust/src/plane/reimplemented.rs +++ b/rust/src/plane/reimplemented.rs @@ -5,8 +5,8 @@ use core::ptr::null_mut; use crate::ffi::__va_list_tag; use crate::{ cell_release, cstring, ncplane_channels, NcAlign, NcAlphaBits, NcBoxMask, NcCell, NcChannel, - NcChannelPair, NcColor, NcDimension, NcEgc, NcIntResult, NcPlane, NcRgb, NcStyleMask, - NCRESULT_ERR, NCRESULT_OK, + NcChannelPair, NcColor, NcDim, NcEgc, NcIntResult, NcPlane, NcRgb, NcStyleMask, NCRESULT_ERR, + NCRESULT_OK, }; // Alpha ----------------------------------------------------------------------- @@ -137,12 +137,7 @@ pub fn ncplane_putchar(plane: &mut NcPlane, ch: char) -> NcIntResult { /// /// *Method: NcPlane.[putchar_yx()][NcPlane#method.putchar_yx].* #[inline] -pub fn ncplane_putchar_yx( - plane: &mut NcPlane, - y: NcDimension, - x: NcDimension, - ch: char, -) -> NcIntResult { +pub fn ncplane_putchar_yx(plane: &mut NcPlane, y: NcDim, x: NcDim, ch: char) -> NcIntResult { unsafe { let cell = NcCell::with_char(ch, plane); crate::ncplane_putc_yx(plane, y as i32, x as i32, &cell) @@ -186,11 +181,11 @@ pub fn ncplane_vprintf(plane: &mut NcPlane, format: &str, ap: &mut __va_list_tag /// /// *Method: NcPlane.[dim_x()][NcPlane#method.dim_x].* #[inline] -pub fn ncplane_dim_x(plane: &NcPlane) -> NcDimension { +pub fn ncplane_dim_x(plane: &NcPlane) -> NcDim { unsafe { let mut x = 0; crate::ncplane_dim_yx(plane, null_mut(), &mut x); - x as NcDimension + x as NcDim } } @@ -199,11 +194,11 @@ pub fn ncplane_dim_x(plane: &NcPlane) -> NcDimension { /// *Method: NcPlane.[dim_y()][NcPlane#method.dim_y].* #[inline] #[inline] -pub fn ncplane_dim_y(plane: &NcPlane) -> NcDimension { +pub fn ncplane_dim_y(plane: &NcPlane) -> NcDim { unsafe { let mut y = 0; crate::ncplane_dim_yx(plane, &mut y, null_mut()); - y as NcDimension + y as NcDim } } @@ -212,11 +207,7 @@ pub fn ncplane_dim_y(plane: &NcPlane) -> NcDimension { /// /// *Method: NcPlane.[resize_simple()][NcPlane#method.resize_simple].* #[inline] -pub fn ncplane_resize_simple( - plane: &mut NcPlane, - y_len: NcDimension, - x_len: NcDimension, -) -> NcIntResult { +pub fn ncplane_resize_simple(plane: &mut NcPlane, y_len: NcDim, x_len: NcDim) -> NcIntResult { let (mut old_y, mut old_x) = (0, 0); unsafe { crate::ncplane_dim_yx(plane, &mut old_y, &mut old_x); @@ -258,7 +249,7 @@ pub fn ncplane_resize_simple( /// /// *Method: NcPlane.[align()][NcPlane#method.align].* #[inline] -pub fn ncplane_align(plane: &NcPlane, align: NcAlign, cols: NcDimension) -> NcIntResult { +pub fn ncplane_align(plane: &NcPlane, align: NcAlign, cols: NcDim) -> NcIntResult { crate::notcurses_align(ncplane_dim_x(plane), align, cols) } @@ -275,7 +266,7 @@ pub fn ncplane_align(plane: &NcPlane, align: NcAlign, cols: NcDimension) -> NcIn /// /// *Method: NcPlane.[hline()][NcPlane#method.hline].* #[inline] -pub fn ncplane_hline(plane: &mut NcPlane, cell: &NcCell, len: NcDimension) -> NcIntResult { +pub fn ncplane_hline(plane: &mut NcPlane, cell: &NcCell, len: NcDim) -> NcIntResult { unsafe { crate::ncplane_hline_interp(plane, cell, len as i32, cell.channels, cell.channels) } } @@ -290,7 +281,7 @@ pub fn ncplane_hline(plane: &mut NcPlane, cell: &NcCell, len: NcDimension) -> Nc /// /// *Method: NcPlane.[vline()][NcPlane#method.vline].* #[inline] -pub fn ncplane_vline(plane: &mut NcPlane, cell: &NcCell, len: NcDimension) -> NcIntResult { +pub fn ncplane_vline(plane: &mut NcPlane, cell: &NcCell, len: NcDim) -> NcIntResult { unsafe { crate::ncplane_vline_interp(plane, cell, len as i32, cell.channels, cell.channels) } } @@ -322,8 +313,8 @@ pub fn ncplane_perimeter( lr, hline, vline, - dimy as NcDimension, - dimx as NcDimension, + dimy as NcDim, + dimx as NcDim, boxmask, ) } @@ -376,8 +367,8 @@ pub fn ncplane_perimeter_double( &lr, &hl, &vl, - dimy as NcDimension, - dimx as NcDimension, + dimy as NcDim, + dimx as NcDim, boxmask, ); unsafe { @@ -438,8 +429,8 @@ pub fn ncplane_perimeter_rounded( &lr, &hl, &vl, - dimy as NcDimension, - dimx as NcDimension, + dimy as NcDim, + dimx as NcDim, boxmask, ); unsafe { @@ -472,8 +463,8 @@ pub fn ncplane_box_sized( lr: &NcCell, hline: &NcCell, vline: &NcCell, - y_len: NcDimension, - x_len: NcDimension, + y_len: NcDim, + x_len: NcDim, boxmask: NcBoxMask, ) -> NcIntResult { let (mut y, mut x) = (0, 0); @@ -502,8 +493,8 @@ pub fn ncplane_double_box( plane: &mut NcPlane, stylemask: NcStyleMask, channels: NcChannelPair, - y_stop: NcDimension, - x_stop: NcDimension, + y_stop: NcDim, + x_stop: NcDim, boxmask: NcBoxMask, ) -> NcIntResult { #[allow(unused_assignments)] @@ -561,8 +552,8 @@ pub fn ncplane_double_box_sized( plane: &mut NcPlane, stylemask: NcStyleMask, channels: NcChannelPair, - y_len: NcDimension, - x_len: NcDimension, + y_len: NcDim, + x_len: NcDim, boxmask: NcBoxMask, ) -> NcIntResult { let (mut y, mut x) = (0, 0); @@ -573,8 +564,8 @@ pub fn ncplane_double_box_sized( plane, stylemask, channels, - y as NcDimension + y_len - 1, - x as NcDimension + x_len - 1, + y as NcDim + y_len - 1, + x as NcDim + x_len - 1, boxmask, ) } @@ -587,8 +578,8 @@ pub fn ncplane_rounded_box( plane: &mut NcPlane, stylemask: NcStyleMask, channels: NcChannelPair, - y_stop: NcDimension, - x_stop: NcDimension, + y_stop: NcDim, + x_stop: NcDim, boxmask: NcBoxMask, ) -> NcIntResult { #[allow(unused_assignments)] @@ -645,8 +636,8 @@ pub fn ncplane_rounded_box_sized( plane: &mut NcPlane, stylemask: NcStyleMask, channels: NcChannelPair, - y_len: NcDimension, - x_len: NcDimension, + y_len: NcDim, + x_len: NcDim, boxmask: NcBoxMask, ) -> NcIntResult { let (mut y, mut x) = (0, 0); @@ -657,8 +648,8 @@ pub fn ncplane_rounded_box_sized( plane, stylemask, channels, - y as NcDimension + y_len - 1, - x as NcDimension + x_len - 1, + y as NcDim + y_len - 1, + x as NcDim + x_len - 1, boxmask, ) } @@ -680,8 +671,8 @@ pub fn ncplane_gradient_sized( ur: NcChannel, ll: NcChannel, lr: NcChannel, - y_len: NcDimension, - x_len: NcDimension, + y_len: NcDim, + x_len: NcDim, ) -> NcIntResult { if y_len < 1 || x_len < 1 { return NCRESULT_ERR;