rust: further types cleanup

- made sigset_t private.
- made FILE_LIBC & FILE_NC private.
- add NCMETRIC_ prefix to the related constants.
- Improve more comments.
pull/1142/head
joseLuís 4 years ago
parent 8b6495a894
commit 433068a5ae

@ -713,11 +713,13 @@ pub use bindgen::{
// sig ------------------------------------------------------------------------- // sig -------------------------------------------------------------------------
#[doc(inline)] pub(crate) use bindgen::{
pub use bindgen::{
// type definitions // type definitions
sigset_t, sigset_t,
};
#[doc(inline)]
pub use bindgen::{
// structs // structs
//sigaction, //sigaction,

@ -105,7 +105,7 @@ pub const NCCELL_BGDEFAULT_MASK: u32 = crate::bindings::CELL_BGDEFAULT_MASK;
/// Extract these bits to get the background alpha mask /// Extract these bits to get the background alpha mask
pub const NCCELL_BG_ALPHA_MASK: u32 = crate::bindings::CELL_BG_ALPHA_MASK; pub const NCCELL_BG_ALPHA_MASK: u32 = crate::bindings::CELL_BG_ALPHA_MASK;
/// If this bit *and* CELL_BGDEFAULT_MASK are set, we're using a /// If this bit *and* [`CELL_BGDEFAULT_MASK`] are set, we're using a
/// palette-indexed background color /// palette-indexed background color
pub const NCCELL_BG_PALETTE: u32 = crate::bindings::CELL_BG_PALETTE; pub const NCCELL_BG_PALETTE: u32 = crate::bindings::CELL_BG_PALETTE;
@ -118,7 +118,7 @@ pub const NCCELL_FGDEFAULT_MASK: u64 = crate::bindings::CELL_FGDEFAULT_MASK;
/// Extract these bits to get the foreground alpha mask /// Extract these bits to get the foreground alpha mask
pub const NCCELL_FG_ALPHA_MASK: u64 = crate::bindings::CELL_FG_ALPHA_MASK; pub const NCCELL_FG_ALPHA_MASK: u64 = crate::bindings::CELL_FG_ALPHA_MASK;
/// If this bit *and* CELL_BGDEFAULT_MASK are set, we're using a /// If this bit *and* [`CELL_BGDEFAULT_MASK`] are set, we're using a
/// palette-indexed background color /// palette-indexed background color
pub const NCCELL_FG_PALETTE: u64 = crate::bindings::CELL_FG_PALETTE; pub const NCCELL_FG_PALETTE: u64 = crate::bindings::CELL_FG_PALETTE;

@ -21,27 +21,27 @@ pub type NcTime = crate::bindings::timespec;
// //
// to set up a printf()-style maximum field width, // to set up a printf()-style maximum field width,
// you should use [IB]PREFIXFMT (see below). // you should use [IB]PREFIXFMT (see below).
pub const PREFIXCOLUMNS: u32 = crate::bindings::PREFIXCOLUMNS; pub const NCMETRIC_PREFIXCOLUMNS: u32 = crate::bindings::PREFIXCOLUMNS;
// The maximum number of columns used by a mult == 1000 (standard) // The maximum number of columns used by a mult == 1000 (standard)
// ncmetric() call. // ncmetric() call.
pub const BPREFIXCOLUMNS: u32 = crate::bindings::BPREFIXCOLUMNS; pub const NCMETRIC_BPREFIXCOLUMNS: u32 = crate::bindings::BPREFIXCOLUMNS;
// IPREFIXCOLUMNS is the maximum number of columns used by a mult == 1024 // IPREFIXCOLUMNS is the maximum number of columns used by a mult == 1024
// (digital information) ncmetric(). // (digital information) ncmetric().
pub const IPREFIXCOLUMNS: u32 = crate::bindings::IPREFIXCOLUMNS; pub const NCMETRIC_IPREFIXCOLUMNS: u32 = crate::bindings::IPREFIXCOLUMNS;
// //
// Does not include a '\0' (xxx.xxU) // Does not include a '\0' (xxx.xxU)
pub const PREFIXSTRLEN: u32 = crate::bindings::PREFIXSTRLEN; pub const NCMETRIC_PREFIXSTRLEN: u32 = crate::bindings::PREFIXSTRLEN;
// The maximum number of columns used by a mult == 1024 call making use of // The maximum number of columns used by a mult == 1024 call making use of
// the 'i' suffix. // the 'i' suffix.
// Does not include a '\0' (xxxx.xxUi), i == prefix // Does not include a '\0' (xxxx.xxUi), i == prefix
pub const BPREFIXSTRLEN: u32 = crate::bindings::BPREFIXSTRLEN; pub const NCMETRIC_BPREFIXSTRLEN: u32 = crate::bindings::BPREFIXSTRLEN;
// Does not include a '\0' (xxxx.xxU) // Does not include a '\0' (xxxx.xxU)
pub const IPREFIXSTRLEN: u32 = crate::bindings::IPREFIXSTRLEN; pub const NCMETRIC_IPREFIXSTRLEN: u32 = crate::bindings::IPREFIXSTRLEN;
// TODO:? // TODO:?
// WCHAR_MAX_UTF8BYTES // WCHAR_MAX_UTF8BYTES

@ -31,10 +31,9 @@ pub use channel::{
NcAlphaBits, NcBlitSet, NcChannel, NcChannels, NcColor, NcFadeCtx, NcPalette, NcPaletteIndex, NcAlphaBits, NcBlitSet, NcChannel, NcChannels, NcColor, NcFadeCtx, NcPalette, NcPaletteIndex,
NcPixel, NcRgb, NCCHANNEL_ALPHA_MASK, NcPixel, NcRgb, NCCHANNEL_ALPHA_MASK,
}; };
pub use file::{NcFile, FILE_LIBC, FILE_NC}; pub use file::NcFile;
pub use misc::{ pub use misc::{
NcResult, BPREFIXCOLUMNS, BPREFIXSTRLEN, IPREFIXCOLUMNS, IPREFIXSTRLEN, PREFIXCOLUMNS, NcResult, NCMETRIC_BPREFIXCOLUMNS, NCMETRIC_BPREFIXSTRLEN, NCMETRIC_IPREFIXCOLUMNS, NCMETRIC_IPREFIXSTRLEN, NCMETRIC_PREFIXCOLUMNS, NCMETRIC_PREFIXSTRLEN,
PREFIXSTRLEN,
}; };
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,

@ -32,16 +32,16 @@ pub type NcFdPlaneOptions = crate::ncfdplane_options;
/// Left/right-justified, or centered. /// Left/right-justified, or centered.
pub type NcAlign = crate::ncalign_e; pub type NcAlign = crate::ncalign_e;
/// Align an NcPlane or NcTerm /// Left alignment within an [`NcPlane`] or terminal.
pub const NCALIGN_LEFT: NcAlign = crate::ncalign_e_NCALIGN_LEFT; pub const NCALIGN_LEFT: NcAlign = crate::ncalign_e_NCALIGN_LEFT;
/// /// Right alignment within an [`NcPlane`] or terminal.
pub const NCALIGN_RIGHT: NcAlign = crate::ncalign_e_NCALIGN_RIGHT; pub const NCALIGN_RIGHT: NcAlign = crate::ncalign_e_NCALIGN_RIGHT;
/// /// Center alignment within an [`NcPlane`] or terminal.
pub const NCALIGN_CENTER: NcAlign = crate::ncalign_e_NCALIGN_CENTER; pub const NCALIGN_CENTER: NcAlign = crate::ncalign_e_NCALIGN_CENTER;
/// /// Do not align an [`NcPlane`] or terminal.
pub const NCALIGN_UNALIGNED: NcAlign = crate::ncalign_e_NCALIGN_UNALIGNED; pub const NCALIGN_UNALIGNED: NcAlign = crate::ncalign_e_NCALIGN_UNALIGNED;
/// Blitter Mode (`NCBLIT_*`) /// Blitter Mode (`NCBLIT_*`)
@ -50,37 +50,37 @@ pub const NCALIGN_UNALIGNED: NcAlign = crate::ncalign_e_NCALIGN_UNALIGNED;
/// background set to the desired foreground. /// background set to the desired foreground.
pub type NcBlitter = crate::ncblitter_e; pub type NcBlitter = crate::ncblitter_e;
/// space, compatible with ASCII /// [`NcBlitter`] mode using: space, compatible with ASCII
pub const NCBLIT_1x1: NcBlitter = crate::ncblitter_e_NCBLIT_1x1; pub const NCBLIT_1x1: NcBlitter = crate::ncblitter_e_NCBLIT_1x1;
/// halves + 1x1 (space) /// [`NcBlitter`] mode using: halves + 1x1 (space)
/// ▄▀ /// ▄▀
pub const NCBLIT_2x1: NcBlitter = crate::ncblitter_e_NCBLIT_2x1; pub const NCBLIT_2x1: NcBlitter = crate::ncblitter_e_NCBLIT_2x1;
/// quadrants + 2x1 /// [`NcBlitter`] mode using: quadrants + 2x1
/// ▗▐ ▖▀▟▌▙ /// ▗▐ ▖▀▟▌▙
pub const NCBLIT_2x2: NcBlitter = crate::ncblitter_e_NCBLIT_2x2; pub const NCBLIT_2x2: NcBlitter = crate::ncblitter_e_NCBLIT_2x2;
/// sextants (NOT 2x2) /// [`NcBlitter`] mode using: sextants
/// 🬀🬁🬂🬃🬄🬅🬆🬇🬈🬉🬊🬋🬌🬍🬎🬏🬐🬑🬒🬓🬔🬕🬖🬗🬘🬙🬚🬛🬜🬝🬞🬟🬠🬡🬢🬣🬤🬥🬦🬧🬨🬩🬪🬫🬬🬭🬮🬯🬰🬱🬲🬳🬴🬵🬶🬷🬸🬹🬺🬻 /// 🬀🬁🬂🬃🬄🬅🬆🬇🬈🬉🬊🬋🬌🬍🬎🬏🬐🬑🬒🬓🬔🬕🬖🬗🬘🬙🬚🬛🬜🬝🬞🬟🬠🬡🬢🬣🬤🬥🬦🬧🬨🬩🬪🬫🬬🬭🬮🬯🬰🬱🬲🬳🬴🬵🬶🬷🬸🬹🬺🬻
pub const NCBLIT_3x2: NcBlitter = crate::ncblitter_e_NCBLIT_3x2; pub const NCBLIT_3x2: NcBlitter = crate::ncblitter_e_NCBLIT_3x2;
/// four vertical levels /// [`NcBlitter`] mode using: four vertical levels
/// █▆▄▂ /// █▆▄▂
pub const NCBLIT_4x1: NcBlitter = crate::ncblitter_e_NCBLIT_4x1; pub const NCBLIT_4x1: NcBlitter = crate::ncblitter_e_NCBLIT_4x1;
/// eight vertical levels /// [`NcBlitter`] mode using: eight vertical levels
/// █▇▆▅▄▃▂▁ /// █▇▆▅▄▃▂▁
pub const NCBLIT_8x1: NcBlitter = crate::ncblitter_e_NCBLIT_8x1; pub const NCBLIT_8x1: NcBlitter = crate::ncblitter_e_NCBLIT_8x1;
/// 4 rows, 2 cols (braille) /// [`NcBlitter`] mode using: 4 rows, 2 cols (braille)
/// ⡀⡄⡆⡇⢀⣀⣄⣆⣇⢠⣠⣤⣦⣧⢰⣰⣴⣶⣷⢸⣸⣼⣾⣿ /// ⡀⡄⡆⡇⢀⣀⣄⣆⣇⢠⣠⣤⣦⣧⢰⣰⣴⣶⣷⢸⣸⣼⣾⣿
pub const NCBLIT_BRAILLE: NcBlitter = crate::ncblitter_e_NCBLIT_BRAILLE; pub const NCBLIT_BRAILLE: NcBlitter = crate::ncblitter_e_NCBLIT_BRAILLE;
/// the blitter is automatically chosen /// [`NcBlitter`] mode where the blitter is automatically chosen
pub const NCBLIT_DEFAULT: NcBlitter = crate::ncblitter_e_NCBLIT_DEFAULT; pub const NCBLIT_DEFAULT: NcBlitter = crate::ncblitter_e_NCBLIT_DEFAULT;
/// not yet implemented /// [`NcBlitter`] mode (not yet implemented)
pub const NCBLIT_SIXEL: NcBlitter = crate::ncblitter_e_NCBLIT_SIXEL; pub const NCBLIT_SIXEL: NcBlitter = crate::ncblitter_e_NCBLIT_SIXEL;
/// How to scale an [`NcVisual`] during rendering /// How to scale an [`NcVisual`] during rendering

Loading…
Cancel
Save