rust: clear all mention of ncplane->horiz #1115

This commit is contained in:
nick black 2020-11-17 22:02:41 -05:00 committed by Nick Black
parent bc245e09fc
commit ee019b2d5a
3 changed files with 12 additions and 32 deletions

View File

@ -166,8 +166,8 @@ use crate::{
ncplane_putegc_yx, ncplane_putnstr_yx, ncplane_putstr_yx, ncplane_resize, ncplane_vline_interp, ncplane_putegc_yx, ncplane_putnstr_yx, ncplane_putstr_yx, ncplane_resize, ncplane_vline_interp,
ncplane_vprintf_yx, notcurses_align, ncplane_vprintf_yx, notcurses_align,
types::{ types::{
AlphaBits, Cell, Channel, Channels, Color, EgcBackstop, IntResult, NcAlign, NcHoriz, AlphaBits, Cell, Channel, Channels, Color, EgcBackstop, IntResult, NcAlign,
NcPlane, NcPlaneOptionHoriz, NcPlaneOptions, StyleMask, NCPLANE_OPTION_HORALIGNED, NcPlane, NcPlaneOptions, StyleMask, NCPLANE_OPTION_HORALIGNED,
}, },
}; };
@ -175,15 +175,15 @@ use crate::{
impl NcPlaneOptions { impl NcPlaneOptions {
/// `NcPlaneOptions` simple constructor with horizontal x /// `NcPlaneOptions` simple constructor with horizontal x
pub fn new(y: i32, x: i32, rows: u32, cols: u32) -> Self { pub fn new(y: i32, x: u32, rows: u32, cols: u32) -> Self {
Self::with_all_options(y, NcHoriz::x(x), rows, cols, 0) Self::with_all_options(y, x, rows, cols, 0)
} }
/// `NcPlaneOptions` simple constructor with horizontal alignment /// `NcPlaneOptions` simple constructor with horizontal alignment
pub fn new_halign(y: i32, align: NcAlign, rows: u32, cols: u32) -> Self { pub fn new_halign(y: i32, align: NcAlign, rows: u32, cols: u32) -> Self {
Self::with_all_options( Self::with_all_options(
y, y,
NcHoriz::align(align), align,
rows, rows,
cols, cols,
NCPLANE_OPTION_HORALIGNED, NCPLANE_OPTION_HORALIGNED,
@ -191,15 +191,10 @@ impl NcPlaneOptions {
} }
/// `NcplaneOptions` constructor /// `NcplaneOptions` constructor
pub fn with_all_options(y: i32, horiz: NcHoriz, rows: u32, cols: u32, flags: u64) -> Self { pub fn with_all_options(y: i32, align: NcAlign, rows: u32, cols: u32, flags: u64) -> Self {
NcPlaneOptions { NcPlaneOptions {
y, y,
horiz: { align,
match horiz {
NcHoriz::x(data) => NcPlaneOptionHoriz { x: data },
NcHoriz::align(data) => NcPlaneOptionHoriz { align: data },
}
},
rows: rows as i32, rows: rows as i32,
cols: cols as i32, cols: cols as i32,
userptr: null_mut(), userptr: null_mut(),

View File

@ -38,10 +38,10 @@ pub use misc::{
}; };
pub use plane::{ pub use plane::{
NCBLIT_1x1, NCBLIT_2x1, NCBLIT_2x2, NCBLIT_3x2, NCBLIT_4x1, NCBLIT_8x1, NcAlign, NcBlitter, NCBLIT_1x1, NCBLIT_2x1, NCBLIT_2x2, NCBLIT_3x2, NCBLIT_4x1, NCBLIT_8x1, NcAlign, NcBlitter,
NcFdPlane, NcFdPlaneOptions, NcHoriz, NcPlane, NcPlaneOptionHoriz, NcPlaneOptions, NcScale, NcFdPlane, NcFdPlaneOptions, NcPlane, NcPlaneOptions, NcScale, NcVisual, NcVisualOptions,
NcVisual, NcVisualOptions, NCALIGN_CENTER, NCALIGN_LEFT, NCALIGN_RIGHT, NCALIGN_UNALIGNED, NCALIGN_CENTER, NCALIGN_LEFT, NCALIGN_RIGHT, NCALIGN_UNALIGNED, NCBLIT_BRAILLE, NCBLIT_DEFAULT,
NCBLIT_BRAILLE, NCBLIT_DEFAULT, NCBLIT_SIXEL, NCPLANE_OPTION_HORALIGNED, NCSCALE_NONE, NCBLIT_SIXEL, NCPLANE_OPTION_HORALIGNED, NCSCALE_NONE, NCSCALE_SCALE, NCSCALE_STRETCH,
NCSCALE_SCALE, NCSCALE_STRETCH, NCVISUAL_OPTION_BLEND, NCVISUAL_OPTION_NODEGRADE, NCVISUAL_OPTION_BLEND, NCVISUAL_OPTION_NODEGRADE,
}; };
pub use terminal::{ pub use terminal::{
NcDirect, NcDirectFlags, NcInput, NcLogLevel, Notcurses, NotcursesOptions, NcDirect, NcDirectFlags, NcInput, NcLogLevel, Notcurses, NotcursesOptions,

View File

@ -12,24 +12,9 @@ pub type NcPlane = crate::ncplane;
/// Options struct for [`NcPlane`](type.NcPlane.html) /// Options struct for [`NcPlane`](type.NcPlane.html)
pub type NcPlaneOptions = crate::ncplane_options; pub type NcPlaneOptions = crate::ncplane_options;
/// Horizontal alignment relative to the parent plane. Use 'align' instead of 'x'. /// Horizontal alignment relative to the parent plane. Set alignment in 'x'.
pub const NCPLANE_OPTION_HORALIGNED: u64 = crate::bindings::NCPLANE_OPTION_HORALIGNED as u64; pub const NCPLANE_OPTION_HORALIGNED: u64 = crate::bindings::NCPLANE_OPTION_HORALIGNED as u64;
/// The `horiz` union field of [`NcPlaneOptions`](type.NcPlaneOptions)
///
/// It contains the fields:
///
/// - x: i32
/// - align: NcAlign (u32)
///
pub type NcPlaneOptionHoriz = crate::ncplane_options__bindgen_ty_1;
/// This enum is a wrapper over the C `horiz` union, for the `NcPlaneOption` constructor
pub enum NcHoriz {
x(i32),
align(NcAlign),
}
/// I/O wrapper to dump file descriptor to [`NcPlane`](type.NcPlane.html) /// I/O wrapper to dump file descriptor to [`NcPlane`](type.NcPlane.html)
/// ///
/// `type in C: ncfdplane (struct)` /// `type in C: ncfdplane (struct)`