mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-10 09:39:03 -04:00
rust: add more methods.
- add NcChannel & NcChannelPair methods. - add more NcPlane methods. - add comments and intra-links. - refactor intra-links style in all modules.
This commit is contained in:
parent
f1cd068da3
commit
1afa9cc1db
@ -19,6 +19,9 @@ pub trait NcChannelMethods {
|
||||
fn rgb(&self) -> NcRgb;
|
||||
fn set_rgb(&mut self, rgb: NcRgb);
|
||||
|
||||
fn default_p(&self) -> bool;
|
||||
fn set_default(&mut self) -> NcChannel;
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
@ -37,11 +40,15 @@ impl NcChannelMethods for NcChannel {
|
||||
// Alpha
|
||||
|
||||
/// Gets the [NcAlphaBits].
|
||||
///
|
||||
/// *C style function: [channel_alpha()][crate::channel_alpha].*
|
||||
fn alpha(&self) -> NcAlphaBits {
|
||||
crate::channel_alpha(*self)
|
||||
}
|
||||
|
||||
/// Sets the [NcAlphaBits].
|
||||
///
|
||||
/// *C style function: [channel_set_alpha()][crate::channel_set_alpha].*
|
||||
fn set_alpha(&mut self, alpha: NcAlphaBits) {
|
||||
crate::channel_set_alpha(self, alpha)
|
||||
}
|
||||
@ -49,6 +56,8 @@ impl NcChannelMethods for NcChannel {
|
||||
// NcColor
|
||||
|
||||
/// Gets the three [NcColor]s.
|
||||
///
|
||||
/// *C style function: [channel_rgb8()][crate::channel_rgb8].*
|
||||
fn rgb8(&self) -> (NcColor, NcColor, NcColor) {
|
||||
let (mut r, mut g, mut b) = (0, 0, 0);
|
||||
crate::channel_rgb8(*self, &mut r, &mut g, &mut b);
|
||||
@ -57,36 +66,56 @@ impl NcChannelMethods for NcChannel {
|
||||
|
||||
/// Sets the three [NcColor]s, and
|
||||
/// marks the NcChannel as NOT using the default color.
|
||||
///
|
||||
/// *C style function: [channel_set_rgb8()][crate::channel_set_rgb8].*
|
||||
fn set_rgb8(&mut self, r: NcColor, g: NcColor, b: NcColor) {
|
||||
crate::channel_set_rgb8(self, r, g, b);
|
||||
}
|
||||
|
||||
/// Gets the red [NcColor].
|
||||
///
|
||||
/// *C style function: [channel_r()][crate::channel_r].*
|
||||
fn r(&self) -> NcColor {
|
||||
crate::channel_r(*self)
|
||||
}
|
||||
|
||||
/// Gets the green [NcColor].
|
||||
///
|
||||
/// *C style function: [channel_g()][crate::channel_g].*
|
||||
fn g(&self) -> NcColor {
|
||||
crate::channel_g(*self)
|
||||
}
|
||||
|
||||
/// Gets the blue [NcColor].
|
||||
///
|
||||
/// *C style function: [channel_b()][crate::channel_b].*
|
||||
fn b(&self) -> NcColor {
|
||||
crate::channel_b(*self)
|
||||
}
|
||||
|
||||
/// Sets the red [NcColor], and returns the new NcChannel.
|
||||
///
|
||||
/// *C style function: [channel_set_r()][crate::channel_set_r].*
|
||||
//
|
||||
// Not in the C API
|
||||
fn set_r(&mut self, r: NcColor) -> NcChannel {
|
||||
crate::channel_set_r(self, r)
|
||||
}
|
||||
|
||||
/// Sets the green [NcColor], and returns the new NcChannel.
|
||||
///
|
||||
/// *C style function: [channel_set_g()][crate::channel_set_g].*
|
||||
//
|
||||
// Not in the C API
|
||||
fn set_g(&mut self, g: NcColor) -> NcChannel {
|
||||
crate::channel_set_g(self, g)
|
||||
}
|
||||
|
||||
/// Sets the blue [NcColor], and returns the new NcChannel.
|
||||
///
|
||||
/// *C style function: [channel_set_b()][crate::channel_set_b].*
|
||||
//
|
||||
// Not in the C API
|
||||
fn set_b(&mut self, b: NcColor) -> NcChannel {
|
||||
crate::channel_set_b(self, b)
|
||||
}
|
||||
@ -94,15 +123,37 @@ impl NcChannelMethods for NcChannel {
|
||||
// NcRgb
|
||||
|
||||
/// Gets the [NcRgb].
|
||||
///
|
||||
/// *C style function: [channel_rgb()][crate::channel_rgb].*
|
||||
//
|
||||
// Not in the C API
|
||||
fn rgb(&self) -> NcRgb {
|
||||
crate::channel_rgb(*self)
|
||||
}
|
||||
|
||||
/// Sets the [NcRgb] and marks it as NOT using the default color,
|
||||
/// retaining the other bits unchanged.
|
||||
///
|
||||
/// *C style function: [channel_set()][crate::channel_set].*
|
||||
fn set_rgb(&mut self, rgb: NcRgb) {
|
||||
crate::channel_set(self, rgb);
|
||||
}
|
||||
|
||||
// Default
|
||||
|
||||
/// Is this NcChannel using the "default color" rather than RGB/palette-indexed?
|
||||
///
|
||||
/// *C style function: [channel_default_p()][crate::channel_default_p].*
|
||||
fn default_p(&self) -> bool {
|
||||
crate::channel_default_p(*self)
|
||||
}
|
||||
|
||||
/// Marks an NcChannel as using its "default color", which also marks it opaque.
|
||||
///
|
||||
/// *C style function: [channel_set_default()][crate::channel_set_default].*
|
||||
fn set_default(&mut self) -> NcChannel {
|
||||
crate::channel_set_default(self)
|
||||
}
|
||||
}
|
||||
|
||||
// NcChannelPair ---------------------------------------------------------------
|
||||
@ -110,21 +161,29 @@ impl NcChannelMethods for NcChannel {
|
||||
/// # `NcChannelPair` Methods
|
||||
impl NcChannelPairMethods for NcChannelPair {
|
||||
/// Gets the foreground [NcAlphaBits].
|
||||
///
|
||||
/// *C style function: [channels_fg_alpha()][crate::channels_fg_alpha].*
|
||||
fn fg_alpha(&self) -> NcAlphaBits {
|
||||
crate::channels_fg_alpha(*self)
|
||||
}
|
||||
|
||||
/// Gets the background [NcAlphaBits].
|
||||
///
|
||||
/// *C style function: [channels_bg_alpha()][crate::channels_bg_alpha].*
|
||||
fn bg_alpha(&self) -> NcAlphaBits {
|
||||
crate::channels_bg_alpha(*self)
|
||||
}
|
||||
|
||||
/// Sets the foreground [NcAlphaBits].
|
||||
///
|
||||
/// *C style function: [channels_set_fg_alpha()][crate::channels_set_fg_alpha].*
|
||||
fn set_fg_alpha(&mut self, alpha: NcAlphaBits) {
|
||||
crate::channels_set_fg_alpha(self, alpha)
|
||||
}
|
||||
|
||||
/// Sets the background [NcAlphaBits].
|
||||
///
|
||||
/// *C style function: [channels_set_bg_alpha()][crate::channels_set_bg_alpha].*
|
||||
fn set_bg_alpha(&mut self, alpha: NcAlphaBits) {
|
||||
crate::channels_set_bg_alpha(self, alpha)
|
||||
}
|
||||
|
@ -16,20 +16,20 @@
|
||||
// functions manually reimplemented: 39
|
||||
// ------------------------------------------
|
||||
// (X) wont: 3
|
||||
// (W) wrap: 10 / 26
|
||||
// (+) done: 34 / 2
|
||||
// (#) test: 19 / 17
|
||||
// (+) done: 36 / 0
|
||||
// (#) test: 19
|
||||
// (W) wrap: 13
|
||||
// ------------------------------------------
|
||||
//W# channel_alpha
|
||||
//W# channel_b
|
||||
// # channel_default_p
|
||||
//W# channel_default_p
|
||||
//W# channel_g
|
||||
// # channel_palindex_p
|
||||
//W# channel_r
|
||||
//W# channel_rgb8
|
||||
// + channel_set
|
||||
// # channel_set_alpha
|
||||
// # channel_set_default
|
||||
//W# channel_set_alpha
|
||||
//W# channel_set_default
|
||||
//W# channel_set_rgb8
|
||||
// X channel_set_rgb_clipped ---
|
||||
// # channels_bchannel
|
||||
|
@ -9,12 +9,16 @@ use crate::{
|
||||
// Alpha -----------------------------------------------------------------------
|
||||
|
||||
/// Gets the [NcAlphaBits] from an [NcChannel].
|
||||
///
|
||||
/// *Method: NcChannel.[alpha()][NcChannel#method.alpha]*
|
||||
#[inline]
|
||||
pub const fn channel_alpha(channel: NcChannel) -> NcAlphaBits {
|
||||
channel & NCCHANNEL_ALPHA_MASK
|
||||
}
|
||||
|
||||
/// Sets the [NcAlphaBits] of an [NcChannel].
|
||||
///
|
||||
/// *Method: NcChannel.[set_alpha()][NcChannel#method.set_alpha]*
|
||||
#[inline]
|
||||
pub fn channel_set_alpha(channel: &mut NcChannel, alpha: NcAlphaBits) {
|
||||
let alpha_clean = alpha & NCCHANNEL_ALPHA_MASK;
|
||||
@ -27,18 +31,24 @@ pub fn channel_set_alpha(channel: &mut NcChannel, alpha: NcAlphaBits) {
|
||||
}
|
||||
|
||||
/// Gets the foreground [NcAlphaBits] from an [NcChannelPair], shifted to LSBs.
|
||||
///
|
||||
/// *Method: NcChannelPair.[fg_alpha()][NcChannelPair#method.fg_alpha]*
|
||||
#[inline]
|
||||
pub const fn channels_fg_alpha(channels: NcChannelPair) -> NcAlphaBits {
|
||||
channel_alpha(channels_fchannel(channels))
|
||||
}
|
||||
|
||||
/// Gets the background [NcAlphaBits] from an [NcChannelPair], shifted to LSBs.
|
||||
///
|
||||
/// *Method: NcChannelPair.[bg_alpha()][NcChannelPair#method.bg_alpha]*
|
||||
#[inline]
|
||||
pub const fn channels_bg_alpha(channels: NcChannelPair) -> NcAlphaBits {
|
||||
channel_alpha(channels_bchannel(channels))
|
||||
}
|
||||
|
||||
/// Sets the [NcAlphaBits] of the foreground [NcChannel] of an [NcChannelPair].
|
||||
///
|
||||
/// *Method: NcChannelPair.[set_fg_alpha()][NcChannelPair#method.set_fg_alpha]*
|
||||
#[inline]
|
||||
pub fn channels_set_fg_alpha(channels: &mut NcChannelPair, alpha: NcAlphaBits) {
|
||||
let mut channel = channels_fchannel(*channels);
|
||||
@ -47,6 +57,8 @@ pub fn channels_set_fg_alpha(channels: &mut NcChannelPair, alpha: NcAlphaBits) {
|
||||
}
|
||||
|
||||
/// Sets the [NcAlphaBits] of the background [NcChannel] of an [NcChannelPair].
|
||||
///
|
||||
/// *Method: NcChannelPair.[set_bg_alpha()][NcChannelPair#method.set_bg_alpha]*
|
||||
#[inline]
|
||||
pub fn channels_set_bg_alpha(channels: &mut NcChannelPair, alpha: NcAlphaBits) {
|
||||
let mut alpha_clean = alpha;
|
||||
@ -62,18 +74,24 @@ pub fn channels_set_bg_alpha(channels: &mut NcChannelPair, alpha: NcAlphaBits) {
|
||||
// Channels --------------------------------------------------------------------
|
||||
|
||||
/// Extracts the background [NcChannel] from a [NcChannelPair].
|
||||
///
|
||||
/// *Method: NcChannelPair.[bchannel()][NcChannelPair#method.bchannel]*
|
||||
#[inline]
|
||||
pub const fn channels_bchannel(channels: NcChannelPair) -> NcChannel {
|
||||
(channels & 0xffffffff_u64) as NcChannel
|
||||
}
|
||||
|
||||
/// Extracts the foreground [NcChannel] from an [NcChannelPair].
|
||||
///
|
||||
/// *Method: NcChannelPair.[fchannel()][NcChannelPair#method.fchannel]*
|
||||
#[inline]
|
||||
pub const fn channels_fchannel(channels: NcChannelPair) -> NcChannel {
|
||||
channels_bchannel(channels >> 32)
|
||||
}
|
||||
|
||||
/// Sets the background [NcChannel] of an [NcChannelPair].
|
||||
///
|
||||
/// *Method: NcChannelPair.[set_bchannel()][NcChannelPair#method.set_bchannel]*
|
||||
#[inline]
|
||||
pub fn channels_set_bchannel(channels: &mut NcChannelPair, bchannel: NcChannel) -> NcChannelPair {
|
||||
*channels = (*channels & 0xffffffff00000000_u64) | bchannel as u64;
|
||||
@ -81,6 +99,8 @@ pub fn channels_set_bchannel(channels: &mut NcChannelPair, bchannel: NcChannel)
|
||||
}
|
||||
|
||||
/// Sets the foreground [NcChannel] of an [NcChannelPair].
|
||||
///
|
||||
/// *Method: NcChannelPair.[set_fchannel()][NcChannelPair#method.set_fchannel]*
|
||||
#[inline]
|
||||
pub fn channels_set_fchannel(channels: &mut NcChannelPair, fchannel: NcChannel) -> NcChannelPair {
|
||||
*channels = (*channels & 0xffffffff_u64) | (fchannel as u64) << 32;
|
||||
@ -88,6 +108,8 @@ pub fn channels_set_fchannel(channels: &mut NcChannelPair, fchannel: NcChannel)
|
||||
}
|
||||
|
||||
/// Combines two [NcChannel]s into a [NcChannelPair].
|
||||
///
|
||||
/// *Method: NcChannelPair.[combine()][NcChannelPair#method.combine]*
|
||||
#[inline]
|
||||
pub fn channels_combine(fchannel: NcChannel, bchannel: NcChannel) -> NcChannelPair {
|
||||
let mut channels: NcChannelPair = 0;
|
||||
@ -99,24 +121,33 @@ pub fn channels_combine(fchannel: NcChannel, bchannel: NcChannel) -> NcChannelPa
|
||||
// NcColor ---------------------------------------------------------------------
|
||||
|
||||
/// Gets the red [NcColor] from an [NcChannel].
|
||||
///
|
||||
/// *Method: NcChannel.[r()][NcChannel#method.r]*
|
||||
#[inline]
|
||||
pub const fn channel_r(channel: NcChannel) -> NcColor {
|
||||
((channel & 0xff0000) >> 16) as NcColor
|
||||
}
|
||||
|
||||
/// Gets the green [NcColor] from an [NcChannel].
|
||||
///
|
||||
/// *Method: NcChannel.[g()][NcChannel#method.g]*
|
||||
#[inline]
|
||||
pub const fn channel_g(channel: NcChannel) -> NcColor {
|
||||
((channel & 0x00ff00) >> 8) as NcColor
|
||||
}
|
||||
|
||||
/// Gets the blue [NcColor] from an [NcChannel].
|
||||
///
|
||||
/// *Method: NcChannel.[b()][NcChannel#method.b]*
|
||||
#[inline]
|
||||
pub const fn channel_b(channel: NcChannel) -> NcColor {
|
||||
(channel & 0x0000ff) as NcColor
|
||||
}
|
||||
|
||||
/// Sets the red [NcColor] of an [NcChannel], and returns it.
|
||||
///
|
||||
/// *Method: NcChannel.[set_r()][NcChannel#method.set_r]*
|
||||
//
|
||||
// Not in the C API.
|
||||
#[inline]
|
||||
pub fn channel_set_r(channel: &mut NcChannel, r: NcColor) -> NcChannel {
|
||||
@ -125,6 +156,9 @@ pub fn channel_set_r(channel: &mut NcChannel, r: NcColor) -> NcChannel {
|
||||
}
|
||||
|
||||
/// Sets the green [NcColor] of an [NcChannel], and returns it.
|
||||
///
|
||||
/// *Method: NcChannel.[set_g()][NcChannel#method.set_g]*
|
||||
//
|
||||
// Not in the C API.
|
||||
#[inline]
|
||||
pub fn channel_set_g(channel: &mut NcChannel, g: NcColor) -> NcChannel {
|
||||
@ -133,6 +167,9 @@ pub fn channel_set_g(channel: &mut NcChannel, g: NcColor) -> NcChannel {
|
||||
}
|
||||
|
||||
/// Sets the blue [NcColor] of an [NcChannel], and returns it.
|
||||
///
|
||||
/// *Method: NcChannel.[set_b()][NcChannel#method.set_b]*
|
||||
//
|
||||
// Not in the C API.
|
||||
#[inline]
|
||||
pub fn channel_set_b(channel: &mut NcChannel, b: NcColor) -> NcChannel {
|
||||
@ -141,6 +178,8 @@ pub fn channel_set_b(channel: &mut NcChannel, b: NcColor) -> NcChannel {
|
||||
}
|
||||
|
||||
/// Gets the three RGB [NcColor]s from an [NcChannel], and returns it.
|
||||
///
|
||||
/// *Method: NcChannel.[rgb8()][NcChannel#method.rgb8]*
|
||||
#[inline]
|
||||
pub fn channel_rgb8(
|
||||
channel: NcChannel,
|
||||
@ -156,6 +195,8 @@ pub fn channel_rgb8(
|
||||
|
||||
/// Sets the three RGB [NcColor]s an [NcChannel], and marks it as not using the
|
||||
/// "default color", retaining the other bits unchanged.
|
||||
///
|
||||
/// *Method: NcChannel.[set_rgb8()][NcChannel#method.set_rgb8]*
|
||||
#[inline]
|
||||
pub fn channel_set_rgb8(channel: &mut NcChannel, r: NcColor, g: NcColor, b: NcColor) {
|
||||
let rgb: NcRgb = (r as NcChannel) << 16 | (g as NcChannel) << 8 | (b as NcChannel);
|
||||
@ -164,6 +205,8 @@ pub fn channel_set_rgb8(channel: &mut NcChannel, r: NcColor, g: NcColor, b: NcCo
|
||||
|
||||
/// Gets the three foreground RGB [NcColor]s from an [NcChannelPair], and
|
||||
/// returns the foreground [NcChannel] (which can have some extra bits set).
|
||||
///
|
||||
/// *Method: NcChannelPair.[fg_rgb8()][NcChannelPair#method.fg_rgb8]*
|
||||
#[inline]
|
||||
pub fn channels_fg_rgb8(
|
||||
channels: NcChannelPair,
|
||||
@ -176,6 +219,8 @@ pub fn channels_fg_rgb8(
|
||||
|
||||
/// Gets the three background RGB [NcColor]s from an [NcChannelPair], and
|
||||
/// returns the background [NcChannel] (which can have some extra bits set).
|
||||
///
|
||||
/// *Method: NcChannelPair.[bg_rgb8()][NcChannelPair#method.bg_rgb8]*
|
||||
#[inline]
|
||||
pub fn channels_bg_rgb8(
|
||||
channels: NcChannelPair,
|
||||
@ -188,6 +233,8 @@ pub fn channels_bg_rgb8(
|
||||
|
||||
/// Sets the three foreground RGB [NcColor]s of an [NcChannelPair], and
|
||||
/// marks it as not using the "default color".
|
||||
///
|
||||
/// *Method: NcChannelPair.[set_fg_rgb8()][NcChannelPair#method.set_fg_rgb8]*
|
||||
#[inline]
|
||||
pub fn channels_set_fg_rgb8(channels: &mut NcChannelPair, r: NcColor, g: NcColor, b: NcColor) {
|
||||
let mut channel = channels_fchannel(*channels);
|
||||
@ -197,6 +244,8 @@ pub fn channels_set_fg_rgb8(channels: &mut NcChannelPair, r: NcColor, g: NcColor
|
||||
|
||||
/// Sets the three background RGB [NcColor]s of an [NcChannelPair], and
|
||||
/// marks it as not using the "default color".
|
||||
///
|
||||
/// *Method: NcChannelPair.[set_bg_rgb8()][NcChannelPair#method.set_bg_rgb8]*
|
||||
#[inline]
|
||||
pub fn channels_set_bg_rgb8(channels: &mut NcChannelPair, r: NcColor, g: NcColor, b: NcColor) {
|
||||
let mut channel = channels_bchannel(*channels);
|
||||
@ -207,12 +256,16 @@ pub fn channels_set_bg_rgb8(channels: &mut NcChannelPair, r: NcColor, g: NcColor
|
||||
// NcRgb -----------------------------------------------------------------------
|
||||
|
||||
/// Gets the foreground [NcRgb] from an [NcChannelPair], shifted to LSBs.
|
||||
///
|
||||
/// *Method: NcChannelPair.[fg_rgb()][NcChannelPair#method.fg_rgb]*
|
||||
#[inline]
|
||||
pub fn channels_fg_rgb(channels: NcChannelPair) -> NcChannel {
|
||||
channels_fchannel(channels) & NCCELL_BG_RGB_MASK
|
||||
}
|
||||
|
||||
/// Gets the background [NcRgb] from an [NcChannelPair], shifted to LSBs.
|
||||
///
|
||||
/// *Method: NcChannelPair.[bg_rgb()][NcChannelPair#method.bg_rgb]*
|
||||
#[inline]
|
||||
pub fn channels_bg_rgb(channels: NcChannelPair) -> NcChannel {
|
||||
channels_bchannel(channels) & NCCELL_BG_RGB_MASK
|
||||
@ -221,6 +274,9 @@ pub fn channels_bg_rgb(channels: NcChannelPair) -> NcChannel {
|
||||
/// Gets the [NcRgb] of an [NcChannel].
|
||||
///
|
||||
/// This function basically removes the 4th byte of the NcChannel.
|
||||
///
|
||||
/// *Method: NcChannel.[rgb()][NcChannel#method.rgb]*
|
||||
//
|
||||
// Not in the C API
|
||||
#[inline]
|
||||
pub const fn channel_rgb(channel: NcChannel) -> NcRgb {
|
||||
@ -229,6 +285,8 @@ pub const fn channel_rgb(channel: NcChannel) -> NcRgb {
|
||||
|
||||
/// Sets the [NcRgb] of an [NcChannel], and marks it
|
||||
/// as not using the "default color", retaining the other bits unchanged.
|
||||
///
|
||||
/// *Method: NcChannel.[set()][NcChannel#method.set]*
|
||||
#[inline]
|
||||
pub fn channel_set(channel: &mut NcChannel, rgb: NcRgb) {
|
||||
*channel = (*channel & !NCCELL_BG_RGB_MASK) | NCCELL_BGDEFAULT_MASK | (rgb & 0x00ffffff);
|
||||
@ -236,6 +294,8 @@ pub fn channel_set(channel: &mut NcChannel, rgb: NcRgb) {
|
||||
|
||||
/// Sets the foreground [NcRgb] of an [NcChannelPair],
|
||||
/// and marks it as not using the the "default color".
|
||||
///
|
||||
/// *Method: NcChannelPair.[set_fg_rgb()][NcChannelPair#method.set_fg_rgb]*
|
||||
#[inline]
|
||||
pub fn channels_set_fg_rgb(channels: &mut NcChannelPair, rgb: NcRgb) {
|
||||
let mut channel = channels_fchannel(*channels);
|
||||
@ -245,6 +305,8 @@ pub fn channels_set_fg_rgb(channels: &mut NcChannelPair, rgb: NcRgb) {
|
||||
|
||||
/// Sets the foreground [NcRgb] of an [NcChannelPair],
|
||||
/// and marks it as not using the the "default color".
|
||||
///
|
||||
/// *Method: NcChannelPair.[set_bg_rgb()][NcChannelPair#method.set_bg_rgb]*
|
||||
#[inline]
|
||||
pub fn channels_set_bg_rgb(channels: &mut NcChannelPair, rgb: NcRgb) {
|
||||
let mut channel = channels_bchannel(*channels);
|
||||
@ -255,12 +317,16 @@ pub fn channels_set_bg_rgb(channels: &mut NcChannelPair, rgb: NcRgb) {
|
||||
// Default ---------------------------------------------------------------------
|
||||
|
||||
/// Is this [NcChannel] using the "default color" rather than RGB/palette-indexed?
|
||||
///
|
||||
/// *Method: NcChannel.[default_p()][NcChannel#method.default_p]*
|
||||
#[inline]
|
||||
pub const fn channel_default_p(channel: NcChannel) -> bool {
|
||||
(channel & NCCELL_BGDEFAULT_MASK) == 0
|
||||
}
|
||||
|
||||
/// Marks an [NcChannel] as using its "default color", which also marks it opaque.
|
||||
///
|
||||
/// *Method: NcChannel.[set_default()][NcChannel#method.set_default]*
|
||||
#[inline]
|
||||
pub fn channel_set_default(channel: &mut NcChannel) -> NcChannel {
|
||||
*channel &= !(NCCELL_BGDEFAULT_MASK | NCCELL_ALPHA_HIGHCONTRAST);
|
||||
@ -268,6 +334,8 @@ pub fn channel_set_default(channel: &mut NcChannel) -> NcChannel {
|
||||
}
|
||||
|
||||
/// Is the foreground of an [NcChannelPair] using the "default foreground color"?
|
||||
///
|
||||
/// *Method: NcChannelPair.[fg_default_p()][NcChannelPair#method.fg_default_p]*
|
||||
#[inline]
|
||||
pub fn channels_fg_default_p(channels: NcChannelPair) -> bool {
|
||||
channel_default_p(channels_fchannel(channels))
|
||||
@ -276,6 +344,8 @@ pub fn channels_fg_default_p(channels: NcChannelPair) -> bool {
|
||||
/// Is the background using the "default background color"? The "default
|
||||
/// background color" must generally be used to take advantage of
|
||||
/// terminal-effected transparency.
|
||||
///
|
||||
/// *Method: NcChannelPair.[bg_default_p()][NcChannelPair#method.bg_default_p]*
|
||||
#[inline]
|
||||
pub fn channels_bg_default_p(channels: NcChannelPair) -> bool {
|
||||
channel_default_p(channels_bchannel(channels))
|
||||
@ -283,6 +353,8 @@ pub fn channels_bg_default_p(channels: NcChannelPair) -> bool {
|
||||
|
||||
/// Marks the foreground of an [NcChannelPair] as using its "default color",
|
||||
/// and returns the new [NcChannelPair].
|
||||
///
|
||||
/// *Method: NcChannelPair.[set_fg_default()][NcChannelPair#method.set_fg_default]*
|
||||
#[inline]
|
||||
pub fn channels_set_fg_default(channels: &mut NcChannelPair) -> NcChannelPair {
|
||||
let mut channel = channels_fchannel(*channels);
|
||||
@ -293,6 +365,8 @@ pub fn channels_set_fg_default(channels: &mut NcChannelPair) -> NcChannelPair {
|
||||
|
||||
/// Marks the background of an [NcChannelPair] as using its "default color",
|
||||
/// and returns the new [NcChannelPair].
|
||||
///
|
||||
/// *Method: NcChannelPair.[set_bg_default()][NcChannelPair#method.set_bg_default]*
|
||||
#[inline]
|
||||
pub fn channels_set_bg_default(channels: &mut NcChannelPair) -> NcChannelPair {
|
||||
let mut channel = channels_bchannel(*channels);
|
||||
@ -304,6 +378,8 @@ pub fn channels_set_bg_default(channels: &mut NcChannelPair) -> NcChannelPair {
|
||||
// Palette ---------------------------------------------------------------------
|
||||
|
||||
/// Is this [NcChannel] using palette-indexed color rather than RGB?
|
||||
///
|
||||
/// *Method: NcChannel.[palindex_p()][NcChannel#method.palindex_p]*
|
||||
#[inline]
|
||||
pub fn channel_palindex_p(channel: NcChannel) -> bool {
|
||||
!(channel_default_p(channel) && (channel & NCCELL_BG_PALETTE) == 0)
|
||||
@ -311,6 +387,8 @@ pub fn channel_palindex_p(channel: NcChannel) -> bool {
|
||||
|
||||
/// Is the foreground of an [NcChannelPair] using an [indexed][NcPaletteIndex]
|
||||
/// [NcPalette][crate::NcPalette] color?
|
||||
///
|
||||
/// *Method: NcChannelPair.[fg_palindex_p()][NcChannelPair#method.fg_palindex_p]*
|
||||
#[inline]
|
||||
pub fn channels_fg_palindex_p(channels: NcChannelPair) -> bool {
|
||||
channel_palindex_p(channels_fchannel(channels))
|
||||
@ -318,6 +396,8 @@ pub fn channels_fg_palindex_p(channels: NcChannelPair) -> bool {
|
||||
|
||||
/// Is the background of an [NcChannelPair] using an [indexed][NcPaletteIndex]
|
||||
/// [NcPalette][crate::NcPalette] color?
|
||||
///
|
||||
/// *Method: NcChannelPair.[bg_palindex_p()][NcChannelPair#method.bg_palindex_p]*
|
||||
#[inline]
|
||||
pub fn channels_bg_palindex_p(channels: NcChannelPair) -> bool {
|
||||
channel_palindex_p(channels_bchannel(channels))
|
||||
@ -327,6 +407,8 @@ pub fn channels_bg_palindex_p(channels: NcChannelPair) -> bool {
|
||||
///
|
||||
/// Also sets [NCCELL_FG_PALETTE] and [NCCELL_ALPHA_OPAQUE],
|
||||
/// and clears out [NCCELL_FGDEFAULT_MASK].
|
||||
///
|
||||
/// *Method: NcChannelPair.[set_fg_palindex()][NcChannelPair#method.set_fg_palindex]*
|
||||
#[inline]
|
||||
pub fn channels_set_fg_palindex(channels: &mut NcChannelPair, index: NcPaletteIndex) {
|
||||
*channels |= NCCELL_FGDEFAULT_MASK;
|
||||
@ -340,6 +422,8 @@ pub fn channels_set_fg_palindex(channels: &mut NcChannelPair, index: NcPaletteIn
|
||||
///
|
||||
/// Also sets [NCCELL_BG_PALETTE] and [NCCELL_ALPHA_OPAQUE],
|
||||
/// and clears out [NCCELL_BGDEFAULT_MASK].
|
||||
///
|
||||
/// *Method: NcChannelPair.[set_bg_palindex()][NcChannelPair#method.set_bg_palindex]*
|
||||
#[inline]
|
||||
pub fn channels_set_bg_palindex(channels: &mut NcChannelPair, index: NcPaletteIndex) {
|
||||
*channels |= NCCELL_BGDEFAULT_MASK as NcChannelPair;
|
||||
|
@ -124,7 +124,7 @@ impl Notcurses {
|
||||
///
|
||||
/// This NcEgc must be freed by the caller.
|
||||
///
|
||||
/// C style function: [notcurses_at_yx][crate::notcurses_at_yx]
|
||||
/// *C style function: [notcurses_at_yx()][crate::notcurses_at_yx].*
|
||||
pub fn at_yx(
|
||||
&mut self,
|
||||
y: NcDimension,
|
||||
@ -142,7 +142,7 @@ impl Notcurses {
|
||||
|
||||
/// Returns the bottommost [NcPlane], of which there is always at least one.
|
||||
///
|
||||
/// C style function: [notcurses_bottom][crate::notcurses_bottom]
|
||||
/// *C style function: [notcurses_bottom()][crate::notcurses_bottom].*
|
||||
pub fn bottom<'a>(&'a mut self) -> &'a mut NcPlane {
|
||||
unsafe { &mut *crate::notcurses_bottom(self) }
|
||||
}
|
||||
@ -151,7 +151,7 @@ impl Notcurses {
|
||||
///
|
||||
/// Requires the "ccc" terminfo capability.
|
||||
///
|
||||
/// C style function: [notcurses_canchangecolor][crate::notcurses_canchangecolor]
|
||||
/// *C style function: [notcurses_canchangecolor()][crate::notcurses_canchangecolor].*
|
||||
pub fn canchangecolor(&self) -> bool {
|
||||
unsafe { crate::notcurses_canchangecolor(self) }
|
||||
}
|
||||
@ -160,7 +160,7 @@ impl Notcurses {
|
||||
///
|
||||
/// Fading requires either the "rgb" or "ccc" terminfo capability.
|
||||
///
|
||||
/// C style function: [notcurses_canfade][crate::notcurses_canfade]
|
||||
/// *C style function: [notcurses_canfade()][crate::notcurses_canfade].*
|
||||
pub fn canfade(&self) -> bool {
|
||||
unsafe { crate::notcurses_canfade(self) }
|
||||
}
|
||||
@ -169,7 +169,7 @@ impl Notcurses {
|
||||
///
|
||||
/// This requires being built against FFmpeg/OIIO.
|
||||
///
|
||||
/// C style function: [notcurses_canopen_images][crate::notcurses_canopen_images]
|
||||
/// *C style function: [notcurses_canopen_images()][crate::notcurses_canopen_images].*
|
||||
pub fn canopen_images(&self) -> bool {
|
||||
unsafe { crate::notcurses_canopen_images(self) }
|
||||
}
|
||||
@ -178,7 +178,7 @@ impl Notcurses {
|
||||
///
|
||||
/// This requires being built against FFmpeg.
|
||||
///
|
||||
/// C style function: [notcurses_canopen_videos][crate::notcurses_canopen_videos]
|
||||
/// *C style function: [notcurses_canopen_videos()][crate::notcurses_canopen_videos].*
|
||||
pub fn canopen_videos(&self) -> bool {
|
||||
unsafe { crate::notcurses_canopen_videos(self) }
|
||||
}
|
||||
@ -187,7 +187,7 @@ impl Notcurses {
|
||||
///
|
||||
/// See [NCBLIT_SIXEL][crate::NCBLIT_SIXEL].
|
||||
///
|
||||
/// C style function: [notcurses_cansixel][crate::notcurses_cansixel]
|
||||
/// *C style function: [notcurses_cansixel()][crate::notcurses_cansixel].*
|
||||
pub fn cansixel(&self) -> bool {
|
||||
unsafe { crate::notcurses_cansixel(self) }
|
||||
}
|
||||
@ -195,7 +195,7 @@ impl Notcurses {
|
||||
/// Returns true if it's possible to directly specify RGB values per cell,
|
||||
/// or false if it's only possible to use palettes.
|
||||
///
|
||||
/// C style function: [notcurses_cantruecolor][crate::notcurses_cantruecolor]
|
||||
/// *C style function: [notcurses_cantruecolor()][crate::notcurses_cantruecolor].*
|
||||
pub fn cantruecolor(&self) -> bool {
|
||||
unsafe { crate::notcurses_cantruecolor(self) }
|
||||
}
|
||||
@ -204,7 +204,7 @@ impl Notcurses {
|
||||
///
|
||||
/// Requires `LANG` being set to a UTF-8 locale.
|
||||
///
|
||||
/// C style function: [notcurses_canutf8][crate::notcurses_canutf8]
|
||||
/// *C style function: [notcurses_canutf8()][crate::notcurses_canutf8].*
|
||||
pub fn canutf8(&self) -> bool {
|
||||
unsafe { crate::notcurses_canutf8(self) }
|
||||
}
|
||||
@ -213,7 +213,7 @@ impl Notcurses {
|
||||
///
|
||||
/// Immediate effect (no need for a call to notcurses_render()).
|
||||
///
|
||||
/// C style function: [notcurses_cursor_disable][crate::notcurses_cursor_disable]
|
||||
/// *C style function: [notcurses_cursor_disable()][crate::notcurses_cursor_disable].*
|
||||
pub fn cursor_disable(&mut self) -> NcResult {
|
||||
unsafe { crate::notcurses_cursor_disable(self) }
|
||||
}
|
||||
@ -223,7 +223,7 @@ impl Notcurses {
|
||||
/// Immediate effect (no need for a call to notcurses_render()).
|
||||
/// It is an error if `y`, `x` lies outside the standard plane.
|
||||
///
|
||||
/// C style function: [notcurses_cursor_enable][crate::notcurses_cursor_enable]
|
||||
/// *C style function: [notcurses_cursor_enable()][crate::notcurses_cursor_enable].*
|
||||
pub fn cursor_enable(&mut self, y: NcDimension, x: NcDimension) -> NcResult {
|
||||
unsafe { crate::notcurses_cursor_enable(self, y as i32, x as i32) }
|
||||
}
|
||||
@ -233,7 +233,7 @@ impl Notcurses {
|
||||
/// Output is freeform, and subject to change. It includes geometry of all
|
||||
/// planes, from all piles.
|
||||
///
|
||||
/// C style function: [notcurses_debug][crate::notcurses_debug]
|
||||
/// *C style function: [notcurses_debug()][crate::notcurses_debug].*
|
||||
pub fn debug(&mut self, debugfp: &mut NcFile) {
|
||||
unsafe {
|
||||
crate::notcurses_debug(self, debugfp.as_nc_ptr());
|
||||
@ -242,7 +242,7 @@ impl Notcurses {
|
||||
|
||||
/// Destroys all [NcPlane]s other than the stdplane.
|
||||
///
|
||||
/// C style function: [notcurses_drop_planes][crate::notcurses_drop_planes]
|
||||
/// *C style function: [notcurses_drop_planes()][crate::notcurses_drop_planes].*
|
||||
pub fn drop_planes(&mut self) {
|
||||
unsafe {
|
||||
crate::notcurses_drop_planes(self);
|
||||
@ -250,19 +250,19 @@ impl Notcurses {
|
||||
}
|
||||
|
||||
///
|
||||
/// C style function: [notcurses_getc][crate::notcurses_getc]
|
||||
/// *C style function: [notcurses_getc()][crate::notcurses_getc].*
|
||||
pub fn getc(&mut self, time: &NcTime, sigmask: &mut sigset_t, input: &mut NcInput) -> char {
|
||||
unsafe { core::char::from_u32_unchecked(crate::notcurses_getc(self, time, sigmask, input)) }
|
||||
}
|
||||
|
||||
///
|
||||
/// C style function: [notcurses_getc_nblock][crate::notcurses_getc_nblock]
|
||||
/// *C style function: [notcurses_getc_nblock()][crate::notcurses_getc_nblock].*
|
||||
pub fn getc_nblock(&mut self, input: &mut NcInput) -> char {
|
||||
crate::notcurses_getc_nblock(self, input)
|
||||
}
|
||||
|
||||
///
|
||||
/// C style function: [notcurses_getc_nblocking][crate::notcurses_getc_nblocking]
|
||||
/// *C style function: [notcurses_getc_nblocking()][crate::notcurses_getc_nblocking].*
|
||||
pub fn getc_nblocking(&mut self, input: &mut NcInput) -> char {
|
||||
crate::notcurses_getc_nblocking(self, input)
|
||||
}
|
||||
@ -270,19 +270,19 @@ impl Notcurses {
|
||||
/// Gets a file descriptor suitable for input event poll()ing.
|
||||
///
|
||||
/// When this descriptor becomes available, you can call
|
||||
/// [getc_nblock][Notcurses#method.getc_nblock](), and input ought be ready.
|
||||
/// [getc_nblock()][Notcurses#method.getc_nblock], and input ought be ready.
|
||||
///
|
||||
/// This file descriptor is not necessarily the file descriptor associated
|
||||
/// with stdin (but it might be!).
|
||||
///
|
||||
/// C style function: [notcurses_inputready_fd][crate::notcurses_inputready_fd]
|
||||
/// *C style function: [notcurses_inputready_fd()][crate::notcurses_inputready_fd].*
|
||||
pub fn inputready_fd(&mut self) -> NcResult {
|
||||
unsafe { crate::notcurses_inputready_fd(self) }
|
||||
}
|
||||
|
||||
/// Returns an [NcBlitter] from a string representation.
|
||||
///
|
||||
/// C style function: [notcurses_lex_blitter][crate::notcurses_lex_blitter]
|
||||
/// *C style function: [notcurses_lex_blitter()][crate::notcurses_lex_blitter].*
|
||||
pub fn lex_blitter(op: &str) -> Option<NcBlitter> {
|
||||
let mut blitter = 0;
|
||||
let res = unsafe { crate::notcurses_lex_blitter(cstring![op], &mut blitter) };
|
||||
@ -297,14 +297,14 @@ impl Notcurses {
|
||||
/// There can be either a single number, which will define all margins equally,
|
||||
/// or there can be four numbers separated by commas.
|
||||
///
|
||||
/// C style function: [notcurses_lex_margins][crate::notcurses_lex_margins]
|
||||
/// *C style function: [notcurses_lex_margins()][crate::notcurses_lex_margins].*
|
||||
pub fn lex_margins(op: &str, options: &mut NotcursesOptions) -> NcResult {
|
||||
unsafe { crate::notcurses_lex_margins(cstring![op], options) }
|
||||
}
|
||||
|
||||
/// Returns an [NcScale] from a string representation.
|
||||
///
|
||||
/// C style function: [notcurses_lex_scalemode][crate::notcurses_lex_scalemode]
|
||||
/// *C style function: [notcurses_lex_scalemode()][crate::notcurses_lex_scalemode].*
|
||||
pub fn lex_scalemode(op: &str) -> Option<NcScale> {
|
||||
let mut scalemode = 0;
|
||||
let res = unsafe { crate::notcurses_lex_scalemode(cstring![op], &mut scalemode) };
|
||||
@ -317,7 +317,7 @@ impl Notcurses {
|
||||
/// Disables signals originating from the terminal's line discipline, i.e.
|
||||
/// SIGINT (^C), SIGQUIT (^), and SIGTSTP (^Z). They are enabled by default.
|
||||
///
|
||||
/// C style function: [notcurses_linesigs_disable][crate::notcurses_linesigs_disable]
|
||||
/// *C style function: [notcurses_linesigs_disable()][crate::notcurses_linesigs_disable].*
|
||||
pub fn linesigs_disable(&mut self) -> NcResult {
|
||||
unsafe { crate::notcurses_linesigs_disable(self) }
|
||||
}
|
||||
@ -325,7 +325,7 @@ impl Notcurses {
|
||||
/// Restores signals originating from the terminal's line discipline, i.e.
|
||||
/// SIGINT (^C), SIGQUIT (^), and SIGTSTP (^Z), if disabled.
|
||||
///
|
||||
/// C style function: [notcurses_linesigs_enable][crate::notcurses_linesigs_enable]
|
||||
/// *C style function: [notcurses_linesigs_enable()][crate::notcurses_linesigs_enable].*
|
||||
pub fn linesigs_enable(&mut self) -> NcResult {
|
||||
unsafe { crate::notcurses_linesigs_enable(self) }
|
||||
}
|
||||
@ -334,7 +334,7 @@ impl Notcurses {
|
||||
///
|
||||
/// Any events in the input queue can still be delivered.
|
||||
///
|
||||
/// C style function: [notcurses_mouse_disable][crate::notcurses_mouse_disable]
|
||||
/// *C style function: [notcurses_mouse_disable()][crate::notcurses_mouse_disable].*
|
||||
pub fn mouse_disable(&mut self) -> NcResult {
|
||||
unsafe { crate::notcurses_mouse_disable(self) }
|
||||
}
|
||||
@ -343,9 +343,9 @@ impl Notcurses {
|
||||
/// and UTF8-style extended coordinates.
|
||||
///
|
||||
/// On success, [NCRESULT_OK] is returned, and mouse events will be
|
||||
/// published to [getc][Notcurses#method.getc]().
|
||||
/// published to [getc()][Notcurses#method.getc].
|
||||
///
|
||||
/// C style function: [notcurses_mouse_enable][crate::notcurses_mouse_enable]
|
||||
/// *C style function: [notcurses_mouse_enable()][crate::notcurses_mouse_enable].*
|
||||
pub fn mouse_enable(&mut self) -> NcResult {
|
||||
unsafe { crate::notcurses_mouse_enable(self) }
|
||||
}
|
||||
@ -356,7 +356,7 @@ impl Notcurses {
|
||||
/// Note that several terminal emulators advertise more colors than they
|
||||
/// actually support, downsampling internally.
|
||||
///
|
||||
/// C style function: [notcurses_palette_size][crate::notcurses_palette_size]
|
||||
/// *C style function: [notcurses_palette_size()][crate::notcurses_palette_size].*
|
||||
pub fn palette_size(&mut self) -> u32 {
|
||||
unsafe { crate::notcurses_palette_size(self) }
|
||||
}
|
||||
@ -369,7 +369,7 @@ impl Notcurses {
|
||||
/// [NCKEY_RESIZE][crate::NCKEY_RESIZE] event has been read and you're not
|
||||
/// yet ready to render.
|
||||
///
|
||||
/// C style function: [notcurses_refresh][crate::notcurses_refresh]
|
||||
/// *C style function: [notcurses_refresh()][crate::notcurses_refresh].*
|
||||
//
|
||||
// TODO: try returning Result<(NcDimension, NcDimension), NcResult>
|
||||
pub fn refresh(&mut self, y: &mut NcDimension, x: &mut NcDimension) -> NcResult {
|
||||
@ -378,7 +378,7 @@ impl Notcurses {
|
||||
|
||||
/// Renders and rasterizes the standard pile in one shot. Blocking call.
|
||||
///
|
||||
/// C style function: [notcurses_render][crate::notcurses_render]
|
||||
/// *C style function: [notcurses_render()][crate::notcurses_render].*
|
||||
pub fn render(&mut self) -> NcResult {
|
||||
unsafe { crate::notcurses_render(self) }
|
||||
}
|
||||
@ -392,7 +392,7 @@ impl Notcurses {
|
||||
///
|
||||
/// The returned buffer must be freed by the caller.
|
||||
///
|
||||
/// C style function: [notcurses_render_to_buffer][crate::notcurses_render_to_buffer]
|
||||
/// *C style function: [notcurses_render_to_buffer()][crate::notcurses_render_to_buffer].*
|
||||
//
|
||||
// CHECK that this works.
|
||||
pub fn render_to_buffer(&mut self, buffer: &mut Vec<u8>) -> NcResult {
|
||||
@ -403,17 +403,17 @@ impl Notcurses {
|
||||
|
||||
/// Writes the last rendered frame, in its entirety, to 'fp'.
|
||||
///
|
||||
/// If [render][Notcurses#method.render]() has not yet been called,
|
||||
/// If [render()][Notcurses#method.render] has not yet been called,
|
||||
/// nothing will be written.
|
||||
///
|
||||
/// C style function: [notcurses_render_to_file][crate::notcurses_render_to_file]
|
||||
/// *C style function: [notcurses_render_to_file()][crate::notcurses_render_to_file].*
|
||||
pub fn render_to_file(&mut self, fp: &mut NcFile) -> NcResult {
|
||||
unsafe { crate::notcurses_render_to_file(self, fp.as_nc_ptr()) }
|
||||
}
|
||||
|
||||
/// Acquires an atomic snapshot of the Notcurses object's stats.
|
||||
///
|
||||
/// C style function: [notcurses_stats][crate::notcurses_stats]
|
||||
/// *C style function: [notcurses_stats()][crate::notcurses_stats].*
|
||||
pub fn stats(&mut self, stats: &mut NcStats) {
|
||||
unsafe {
|
||||
crate::notcurses_stats(self, stats);
|
||||
@ -425,14 +425,14 @@ impl Notcurses {
|
||||
/// Use this rather than allocating your own, since future versions of
|
||||
/// Notcurses might enlarge this structure.
|
||||
///
|
||||
/// C style function: [notcurses_stats_alloc][crate::notcurses_stats_alloc]
|
||||
/// *C style function: [notcurses_stats_alloc()][crate::notcurses_stats_alloc].*
|
||||
pub fn stats_alloc<'a>(&'a mut self) -> &'a mut NcStats {
|
||||
unsafe { &mut *crate::notcurses_stats_alloc(self) }
|
||||
}
|
||||
|
||||
/// Resets all cumulative stats (immediate ones, such as fbbytes, are not reset).
|
||||
///
|
||||
/// C style function: [notcurses_stats_reset][crate::notcurses_stats_reset]
|
||||
/// *C style function: [notcurses_stats_reset()][crate::notcurses_stats_reset].*
|
||||
pub fn stats_reset(&mut self, stats: &mut NcStats) {
|
||||
unsafe {
|
||||
crate::notcurses_stats_reset(self, stats);
|
||||
@ -444,7 +444,7 @@ impl Notcurses {
|
||||
/// The standard plane always exists, and its origin is always at the
|
||||
/// uppermost, leftmost cell.
|
||||
///
|
||||
/// C style function: [notcurses_stdplane][crate::notcurses_stdplane]
|
||||
/// *C style function: [notcurses_stdplane()][crate::notcurses_stdplane].*
|
||||
pub fn stdplane<'a>(&mut self) -> &'a mut NcPlane {
|
||||
unsafe { &mut *crate::notcurses_stdplane(self) }
|
||||
}
|
||||
@ -454,21 +454,21 @@ impl Notcurses {
|
||||
/// The standard plane always exists, and its origin is always at the
|
||||
/// uppermost, leftmost cell.
|
||||
///
|
||||
/// C style function: [notcurses_stdplane_const][crate::notcurses_stdplane_const]
|
||||
/// *C style function: [notcurses_stdplane_const()][crate::notcurses_stdplane_const].*
|
||||
pub fn stdplane_const<'a>(&self) -> &'a NcPlane {
|
||||
unsafe { &*crate::notcurses_stdplane_const(self) }
|
||||
}
|
||||
|
||||
/// Destroys the Notcurses context.
|
||||
///
|
||||
/// C style function: [notcurses_stop][crate::notcurses_stop]
|
||||
/// *C style function: [notcurses_stop()][crate::notcurses_stop].*
|
||||
pub fn stop(&mut self) -> NcResult {
|
||||
unsafe { crate::notcurses_stop(self) }
|
||||
}
|
||||
|
||||
/// Gets the name of an [NcBlitter] blitter.
|
||||
///
|
||||
/// C style function: [notcurses_str_blitter][crate::notcurses_str_blitter]
|
||||
/// *C style function: [notcurses_str_blitter()][crate::notcurses_str_blitter].*
|
||||
pub fn str_blitter(blitter: NcBlitter) -> String {
|
||||
unsafe {
|
||||
CStr::from_ptr(crate::notcurses_str_blitter(blitter))
|
||||
@ -479,7 +479,7 @@ impl Notcurses {
|
||||
|
||||
/// Gets the name of an [NcScale] scaling mode.
|
||||
///
|
||||
/// C style function: [notcurses_str_scalemode][crate::notcurses_str_scalemode]
|
||||
/// *C style function: [notcurses_str_scalemode()][crate::notcurses_str_scalemode].*
|
||||
pub fn str_scalemode(scalemode: NcScale) -> String {
|
||||
unsafe {
|
||||
CStr::from_ptr(crate::notcurses_str_scalemode(scalemode))
|
||||
@ -495,21 +495,21 @@ impl Notcurses {
|
||||
///
|
||||
/// For more information, see the "ncv" capability in terminfo(5).
|
||||
///
|
||||
/// C style function: [notcurses_supported_styles][crate::notcurses_supported_styles]
|
||||
/// *C style function: [notcurses_supported_styles()][crate::notcurses_supported_styles].*
|
||||
pub fn supported_styles(&self) -> NcStyleMask {
|
||||
unsafe { crate::notcurses_supported_styles(self) as NcStyleMask }
|
||||
}
|
||||
|
||||
/// Returns the topmost [NcPlane], of which there is always at least one.
|
||||
///
|
||||
/// C style function: [notcurses_top][crate::notcurses_top]
|
||||
/// *C style function: [notcurses_top()][crate::notcurses_top].*
|
||||
pub fn top<'a>(&'a mut self) -> &'a mut NcPlane {
|
||||
unsafe { &mut *crate::notcurses_top(self) }
|
||||
}
|
||||
|
||||
/// Returns a human-readable string describing the running Notcurses version.
|
||||
///
|
||||
/// C style function: [notcurses_version][crate::notcurses_version]
|
||||
/// *C style function: [notcurses_version()][crate::notcurses_version].*
|
||||
pub fn version() -> String {
|
||||
unsafe {
|
||||
CStr::from_ptr(crate::notcurses_version())
|
||||
@ -521,7 +521,7 @@ impl Notcurses {
|
||||
/// Returns the running Notcurses version components
|
||||
/// (major, minor, patch, tweak).
|
||||
///
|
||||
/// C style function: [notcurses_version_components][crate::notcurses_version_components]
|
||||
/// *C style function: [notcurses_version_components()][crate::notcurses_version_components].*
|
||||
pub fn version_components() -> (u32, u32, u32, u32) {
|
||||
let (mut major, mut minor, mut patch, mut tweak) = (0, 0, 0, 0);
|
||||
unsafe {
|
||||
|
@ -47,7 +47,7 @@ pub fn notcurses_align(availcols: NcDimension, align: NcAlign, cols: NcDimension
|
||||
/// 'input' may be NULL if the caller is uninterested in event details.
|
||||
/// If no event is ready, returns 0.
|
||||
///
|
||||
/// Rust method: [Notcurses.getc_nblock][Notcurses#method.getc_nblock]
|
||||
/// *Method: Notcurses.[getc_nblock()][Notcurses#method.getc_nblock].*
|
||||
#[inline]
|
||||
pub fn notcurses_getc_nblock(nc: &mut Notcurses, input: &mut NcInput) -> char {
|
||||
unsafe {
|
||||
@ -64,6 +64,8 @@ pub fn notcurses_getc_nblock(nc: &mut Notcurses, input: &mut NcInput) -> char {
|
||||
|
||||
/// 'input' may be NULL if the caller is uninterested in event details.
|
||||
/// Blocks until an event is processed or a signal is received.
|
||||
///
|
||||
/// *Method: Notcurses.[getc_nblocking()][Notcurses#method.getc_nblocking].*
|
||||
#[inline]
|
||||
pub fn notcurses_getc_nblocking(nc: &mut Notcurses, input: &mut NcInput) -> char {
|
||||
unsafe {
|
||||
@ -74,6 +76,8 @@ pub fn notcurses_getc_nblocking(nc: &mut Notcurses, input: &mut NcInput) -> char
|
||||
}
|
||||
|
||||
/// notcurses_stdplane(), plus free bonus dimensions written to non-NULL y/x!
|
||||
///
|
||||
/// *Method: Notcurses.[getc_stddim_yx()][Notcurses#method.stddim_yx].*
|
||||
#[inline]
|
||||
pub fn notcurses_stddim_yx<'a>(
|
||||
nc: &mut Notcurses,
|
||||
@ -88,6 +92,8 @@ pub fn notcurses_stddim_yx<'a>(
|
||||
}
|
||||
|
||||
/// notcurses_stdplane_const(), plus free bonus dimensions written to non-NULL y/x!
|
||||
///
|
||||
/// *Method: Notcurses.[getc_stddim_yx_const()][Notcurses#method.stddim_yx_const].*
|
||||
#[inline]
|
||||
pub fn notcurses_stddim_yx_const<'a>(nc: &'a Notcurses, y: &mut i32, x: &mut i32) -> &'a NcPlane {
|
||||
unsafe {
|
||||
@ -98,6 +104,8 @@ pub fn notcurses_stddim_yx_const<'a>(nc: &'a Notcurses, y: &mut i32, x: &mut i32
|
||||
}
|
||||
|
||||
/// Return our current idea of the terminal dimensions in rows and cols.
|
||||
///
|
||||
/// *Method: Notcurses.[getc_term_yx()][Notcurses#method.term_yx].*
|
||||
#[inline]
|
||||
pub fn notcurses_term_dim_yx(nc: &Notcurses, rows: &mut u32, cols: &mut u32) {
|
||||
unsafe {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -18,12 +18,16 @@ use crate::{
|
||||
// Alpha -----------------------------------------------------------------------
|
||||
|
||||
/// Gets the foreground [NcAlphaBits] from the [NcPlane], shifted to LSBs.
|
||||
///
|
||||
/// *Method: NcPlane.[fg_alpha()][NcPlane#method.fg_alpha].*
|
||||
#[inline]
|
||||
pub fn ncplane_fg_alpha(plane: &NcPlane) -> NcAlphaBits {
|
||||
channels_fg_alpha(unsafe { ncplane_channels(plane) })
|
||||
}
|
||||
|
||||
/// Gets the background [NcAlphaBits] from the [NcPlane], shifted to LSBs.
|
||||
///
|
||||
/// *Method: NcPlane.[bg_alpha()][NcPlane#method.bg_alpha].*
|
||||
#[inline]
|
||||
pub fn ncplane_bg_alpha(plane: &NcPlane) -> NcAlphaBits {
|
||||
channels_bg_alpha(unsafe { ncplane_channels(plane) })
|
||||
@ -32,12 +36,16 @@ pub fn ncplane_bg_alpha(plane: &NcPlane) -> NcAlphaBits {
|
||||
// NcChannel -------------------------------------------------------------------
|
||||
|
||||
/// Gets the foreground [NcChannel] from an [NcPlane].
|
||||
///
|
||||
/// *Method: NcPlane.[fchannel()][NcPlane#method.fchannel].*
|
||||
#[inline]
|
||||
pub fn ncplane_fchannel(plane: &NcPlane) -> NcChannel {
|
||||
channels_fchannel(unsafe { ncplane_channels(plane) })
|
||||
}
|
||||
|
||||
/// Gets the background [NcChannel] from an [NcPlane].
|
||||
///
|
||||
/// *Method: NcPlane.[bchannel()][NcPlane#method.bchannel].*
|
||||
#[inline]
|
||||
pub fn ncplane_bchannel(plane: &NcPlane) -> NcChannel {
|
||||
channels_bchannel(unsafe { ncplane_channels(plane) })
|
||||
@ -47,6 +55,8 @@ pub fn ncplane_bchannel(plane: &NcPlane) -> NcChannel {
|
||||
|
||||
/// Gets the foreground [NcColor] RGB components from an [NcPlane].
|
||||
/// and returns the background [NcChannel].
|
||||
///
|
||||
/// *Method: NcPlane.[fg_rgb8()][NcPlane#method.fg_rgb8].*
|
||||
#[inline]
|
||||
pub fn ncplane_fg_rgb8(
|
||||
plane: &NcPlane,
|
||||
@ -59,6 +69,8 @@ pub fn ncplane_fg_rgb8(
|
||||
|
||||
/// Gets the background [NcColor] RGB components from an [NcPlane],
|
||||
/// and returns the background [NcChannel].
|
||||
///
|
||||
/// *Method: NcPlane.[bg_rgb8()][NcPlane#method.bg_rgb8].*
|
||||
#[inline]
|
||||
pub fn ncplane_bg_rgb8(
|
||||
plane: &NcPlane,
|
||||
@ -72,12 +84,16 @@ pub fn ncplane_bg_rgb8(
|
||||
// NcRgb -----------------------------------------------------------------------
|
||||
|
||||
/// Gets the foreground [NcRgb] from an [NcPlane], shifted to LSBs.
|
||||
///
|
||||
/// *Method: NcPlane.[fg_rgb()][NcPlane#method.fg_rgb].*
|
||||
#[inline]
|
||||
pub fn ncplane_fg_rgb(plane: &NcPlane) -> NcRgb {
|
||||
channels_fg_rgb(unsafe { ncplane_channels(plane) })
|
||||
}
|
||||
|
||||
/// Gets the background [NcRgb] from an [NcPlane], shifted to LSBs.
|
||||
///
|
||||
/// *Method: NcPlane.[bg_rgb()][NcPlane#method.bg_rgb].*
|
||||
#[inline]
|
||||
pub fn ncplane_bg_rgb(plane: &NcPlane) -> NcRgb {
|
||||
channels_bg_rgb(unsafe { ncplane_channels(plane) })
|
||||
@ -86,12 +102,16 @@ pub fn ncplane_bg_rgb(plane: &NcPlane) -> NcRgb {
|
||||
// Default ---------------------------------------------------------------------
|
||||
|
||||
/// Is the plane's foreground using the "default foreground color"?
|
||||
///
|
||||
/// *Method: NcPlane.[fg_default_p()][NcPlane#method.fg_default_p].*
|
||||
#[inline]
|
||||
pub fn ncplane_fg_default_p(plane: &NcPlane) -> bool {
|
||||
channels_fg_default_p(unsafe { ncplane_channels(plane) })
|
||||
}
|
||||
|
||||
/// Is the plane's background using the "default background color"?
|
||||
///
|
||||
/// *Method: NcPlane.[bg_default_p()][NcPlane#method.bg_default_p].*
|
||||
#[inline]
|
||||
pub fn ncplane_bg_default_p(plane: &NcPlane) -> bool {
|
||||
channels_bg_default_p(unsafe { ncplane_channels(plane) })
|
||||
@ -100,12 +120,16 @@ pub fn ncplane_bg_default_p(plane: &NcPlane) -> bool {
|
||||
// put & print -----------------------------------------------------------------
|
||||
|
||||
/// Calls ncplane_putc_yx() for the current cursor location.
|
||||
///
|
||||
/// *Method: NcPlane.[putc()][NcPlane#method.putc].*
|
||||
#[inline]
|
||||
pub fn ncplane_putc(plane: &mut NcPlane, cell: &NcCell) -> NcResult {
|
||||
unsafe { ncplane_putc_yx(plane, -1, -1, cell) }
|
||||
}
|
||||
|
||||
/// Calls ncplane_putchar_yx() at the current cursor location.
|
||||
///
|
||||
/// *Method: NcPlane.[putchar()][NcPlane#method.putchar].*
|
||||
#[inline]
|
||||
pub fn ncplane_putchar(plane: &mut NcPlane, ch: char) -> NcResult {
|
||||
unsafe {
|
||||
@ -116,6 +140,8 @@ pub fn ncplane_putchar(plane: &mut NcPlane, ch: char) -> NcResult {
|
||||
|
||||
/// Replaces the [NcCell] at the specified coordinates with the provided char.
|
||||
/// Advances the cursor by 1.
|
||||
///
|
||||
/// *Method: NcPlane.[putchar_yx()][NcPlane#method.putchar_yx].*
|
||||
#[inline]
|
||||
pub fn ncplane_putchar_yx(
|
||||
plane: &mut NcPlane,
|
||||
@ -130,18 +156,24 @@ pub fn ncplane_putchar_yx(
|
||||
}
|
||||
|
||||
/// Writes a series of [NcEgc]s to the current location, using the current style.
|
||||
///
|
||||
/// *Method: NcPlane.[putstr()][NcPlane#method.putstr].*
|
||||
#[inline]
|
||||
pub fn ncplane_putstr(plane: &mut NcPlane, string: &str) -> NcResult {
|
||||
unsafe { ncplane_putstr_yx(plane, -1, -1, cstring![string]) }
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
/// *Method: NcPlane.[putnstr()][NcPlane#method.putnstr].*
|
||||
#[inline]
|
||||
pub fn ncplane_putnstr(plane: &mut NcPlane, size: u64, gclustarr: &[u8]) -> NcResult {
|
||||
unsafe { ncplane_putnstr_yx(plane, -1, -1, size, cstring![gclustarr]) }
|
||||
}
|
||||
|
||||
/// The [NcPlane] equivalent of `vprintf(3)`.
|
||||
///
|
||||
/// *Method: NcPlane.[vprintf()][NcPlane#method.vprintf].*
|
||||
#[inline]
|
||||
pub fn ncplane_vprintf(plane: &mut NcPlane, format: &str, ap: &mut __va_list_tag) -> NcResult {
|
||||
unsafe { ncplane_vprintf_yx(plane, -1, -1, cstring![format], ap) }
|
||||
@ -152,6 +184,8 @@ pub fn ncplane_vprintf(plane: &mut NcPlane, format: &str, ap: &mut __va_list_tag
|
||||
/// Retrieves the current contents of the [NcCell] under the cursor.
|
||||
///
|
||||
/// This NcCell is invalidated if the associated NcPlane is destroyed.
|
||||
///
|
||||
/// *Method: NcPlane.[at_cursor_cell()][NcPlane#method.at_cursor_cell].*
|
||||
#[inline]
|
||||
pub fn ncplane_at_cursor_cell(plane: &mut NcPlane, cell: &mut NcCell) -> NcResult {
|
||||
let mut egc = unsafe { ncplane_at_cursor(plane, &mut cell.stylemask, &mut cell.channels) };
|
||||
@ -169,6 +203,8 @@ pub fn ncplane_at_cursor_cell(plane: &mut NcPlane, cell: &mut NcCell) -> NcResul
|
||||
|
||||
/// Retrieves the current contents of the specified cell into `cell`.
|
||||
/// This cell is invalidated if the associated plane is destroyed.
|
||||
///
|
||||
/// *Method: NcPlane.[at_yx_cell()][NcPlane#method.at_yx_cell].*
|
||||
#[inline]
|
||||
pub fn ncplane_at_yx_cell(
|
||||
plane: &mut NcPlane,
|
||||
@ -200,6 +236,8 @@ pub fn ncplane_at_yx_cell(
|
||||
// size & alignment ------------------------------------------------------------
|
||||
|
||||
/// Gets the columns of the [NcPlane].
|
||||
///
|
||||
/// *Method: NcPlane.[dim_x()][NcPlane#method.dim_x].*
|
||||
#[inline]
|
||||
pub fn ncplane_dim_x(plane: &NcPlane) -> NcDimension {
|
||||
unsafe {
|
||||
@ -210,6 +248,8 @@ pub fn ncplane_dim_x(plane: &NcPlane) -> NcDimension {
|
||||
}
|
||||
|
||||
/// Gets the rows of the [NcPlane].
|
||||
///
|
||||
/// *Method: NcPlane.[dim_y()][NcPlane#method.dim_y].*
|
||||
#[inline]
|
||||
#[inline]
|
||||
pub fn ncplane_dim_y(plane: &NcPlane) -> NcDimension {
|
||||
@ -222,6 +262,8 @@ pub fn ncplane_dim_y(plane: &NcPlane) -> NcDimension {
|
||||
|
||||
/// Resizes the plane, retaining what data we can (everything, unless we're
|
||||
/// shrinking in some dimension). Keep the origin where it is.
|
||||
///
|
||||
/// *Method: NcPlane.[resize_simple()][NcPlane#method.resize_simple].*
|
||||
#[inline]
|
||||
pub fn ncplane_resize_simple(
|
||||
plane: &mut NcPlane,
|
||||
@ -266,6 +308,8 @@ pub fn ncplane_resize_simple(
|
||||
///
|
||||
/// Returns `-`[`NCRESULT_MAX`][crate::NCRESULT_MAX] if
|
||||
/// [NCALIGN_UNALIGNED][crate::NCALIGN_UNALIGNED] or invalid [NcAlign].
|
||||
///
|
||||
/// *Method: NcPlane.[align()][NcPlane#method.align].*
|
||||
#[inline]
|
||||
pub fn ncplane_align(plane: &NcPlane, align: NcAlign, cols: NcDimension) -> NcResult {
|
||||
notcurses_align(ncplane_dim_x(plane), align, cols)
|
||||
@ -281,6 +325,8 @@ pub fn ncplane_align(plane: &NcPlane, align: NcAlign, cols: NcDimension) -> NcRe
|
||||
///
|
||||
/// Returns the number of cells drawn on success. On error, returns the negative
|
||||
/// number of cells drawn.
|
||||
///
|
||||
/// *Method: NcPlane.[hline()][NcPlane#method.hline].*
|
||||
#[inline]
|
||||
pub fn ncplane_hline(plane: &mut NcPlane, cell: &NcCell, len: NcDimension) -> NcResult {
|
||||
unsafe { ncplane_hline_interp(plane, cell, len as i32, cell.channels, cell.channels) }
|
||||
@ -294,6 +340,8 @@ pub fn ncplane_hline(plane: &mut NcPlane, cell: &NcCell, len: NcDimension) -> Nc
|
||||
///
|
||||
/// Returns the number of cells drawn on success. On error, returns the negative
|
||||
/// number of cells drawn.
|
||||
///
|
||||
/// *Method: NcPlane.[vline()][NcPlane#method.vline].*
|
||||
#[inline]
|
||||
pub fn ncplane_vline(plane: &mut NcPlane, cell: &NcCell, len: NcDimension) -> NcResult {
|
||||
unsafe { ncplane_vline_interp(plane, cell, len as i32, cell.channels, cell.channels) }
|
||||
@ -302,6 +350,8 @@ pub fn ncplane_vline(plane: &mut NcPlane, cell: &NcCell, len: NcDimension) -> Nc
|
||||
// perimeter -------------------------------------------------------------------
|
||||
|
||||
///
|
||||
///
|
||||
/// *Method: NcPlane.[perimeter()][NcPlane#method.perimeter].*
|
||||
#[inline]
|
||||
pub fn ncplane_perimeter(
|
||||
plane: &mut NcPlane,
|
||||
@ -333,6 +383,8 @@ pub fn ncplane_perimeter(
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
/// *Method: NcPlane.[perimeter_double()][NcPlane#method.perimeter_double].*
|
||||
#[inline]
|
||||
pub fn ncplane_perimeter_double(
|
||||
plane: &mut NcPlane,
|
||||
@ -393,6 +445,8 @@ pub fn ncplane_perimeter_double(
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
/// *Method: NcPlane.[perimeter_rounded()][NcPlane#method.perimeter_rounded].*
|
||||
#[inline]
|
||||
pub fn ncplane_perimeter_rounded(
|
||||
plane: &mut NcPlane,
|
||||
@ -457,6 +511,8 @@ pub fn ncplane_perimeter_rounded(
|
||||
/// Draws a box with its upper-left corner at the current cursor position,
|
||||
/// having dimensions `y_len` * `x_len`. See ncplane_box() for more information. The
|
||||
/// minimum box size is 2x2, and it cannot be drawn off-screen.
|
||||
///
|
||||
/// *Method: NcPlane.[box_sized()][NcPlane#method.box_sized].*
|
||||
#[inline]
|
||||
pub fn ncplane_box_sized(
|
||||
plane: &mut NcPlane,
|
||||
@ -489,6 +545,8 @@ pub fn ncplane_box_sized(
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
/// *Method: NcPlane.[double_box()][NcPlane#method.double_box].*
|
||||
#[inline]
|
||||
pub fn ncplane_double_box(
|
||||
plane: &mut NcPlane,
|
||||
@ -546,6 +604,8 @@ pub fn ncplane_double_box(
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
/// *Method: NcPlane.[double_box_sized()][NcPlane#method.double_box_sized].*
|
||||
#[inline]
|
||||
pub fn ncplane_double_box_sized(
|
||||
plane: &mut NcPlane,
|
||||
@ -570,6 +630,8 @@ pub fn ncplane_double_box_sized(
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
/// *Method: NcPlane.[rounded_box()][NcPlane#method.rounded_box].*
|
||||
#[inline]
|
||||
pub fn ncplane_rounded_box(
|
||||
plane: &mut NcPlane,
|
||||
@ -626,6 +688,8 @@ pub fn ncplane_rounded_box(
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
/// *Method: NcPlane.[rounded_box_sized()][NcPlane#method.rounded_box_sized].*
|
||||
#[inline]
|
||||
pub fn ncplane_rounded_box_sized(
|
||||
plane: &mut NcPlane,
|
||||
@ -654,6 +718,8 @@ pub fn ncplane_rounded_box_sized(
|
||||
/// Draw a gradient with its upper-left corner at the current cursor position,
|
||||
/// having dimensions `y_len` * `x_len`. See ncplane_gradient for more information.
|
||||
/// static inline int
|
||||
///
|
||||
/// *Method: NcPlane.[gradient_sized()][NcPlane#method.gradient_sized].*
|
||||
#[inline]
|
||||
pub fn ncplane_gradient_sized(
|
||||
plane: &mut NcPlane,
|
||||
|
@ -28,14 +28,14 @@ impl NcProgBar {
|
||||
|
||||
/// New NcProgBar. Expects an [NcProgBarOptions] struct.
|
||||
///
|
||||
/// C style function: [ncprogbar_create][crate::ncprogbar_create]
|
||||
/// *C style function: [ncprogbar_create()][crate::ncprogbar_create].*
|
||||
pub fn with_options<'a>(plane: &mut NcPlane, options: &NcProgBarOptions) -> &'a mut Self {
|
||||
unsafe { &mut *crate::ncprogbar_create(plane, options) }
|
||||
}
|
||||
|
||||
/// Destroy the progress bar and its underlying ncplane.
|
||||
///
|
||||
/// C style function: [ncprogbar_destroy][crate::ncprogbar_destroy]
|
||||
/// *C style function: [ncprogbar_destroy()][crate::ncprogbar_destroy].*
|
||||
pub fn destroy(&mut self) {
|
||||
unsafe {
|
||||
crate::ncprogbar_destroy(self);
|
||||
@ -44,14 +44,14 @@ impl NcProgBar {
|
||||
|
||||
/// Return a reference to the ncprogbar's underlying ncplane.
|
||||
///
|
||||
/// C style function: [ncprogbar_plane][crate::ncprogbar_plane]
|
||||
/// *C style function: [ncprogbar_plane()][crate::ncprogbar_plane].*
|
||||
pub fn plane<'a>(&'a mut self) -> &'a mut NcPlane {
|
||||
unsafe { &mut *crate::ncprogbar_plane(self) }
|
||||
}
|
||||
|
||||
/// Get the progress bar's completion, an [f64] on [0, 1].
|
||||
///
|
||||
/// C style function: [ncprogbar_progress][crate::ncprogbar_progress]
|
||||
/// *C style function: [ncprogbar_progress()][crate::ncprogbar_progress].*
|
||||
pub fn progress(&self) -> f64 {
|
||||
unsafe { crate::ncprogbar_progress(self) }
|
||||
}
|
||||
@ -60,7 +60,7 @@ impl NcProgBar {
|
||||
///
|
||||
/// Returns [NCRESULT_ERR][crate::NCRESULT_ERR] if progress is < 0 || > 1.
|
||||
///
|
||||
/// C style function: [ncprogbar_set_progress][crate::ncprogbar_set_progress]
|
||||
/// *C style function: [ncprogbar_set_progress()][crate::ncprogbar_set_progress].*
|
||||
pub fn set_progress(&mut self, progress: f64) -> NcResult {
|
||||
unsafe { crate::ncprogbar_set_progress(self, progress) }
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user