rust: finish updating rust for ncdirect changes

- update function and method names.
- update intra-doc links.
- update examples.
pull/1270/head
joseLuís 4 years ago
parent a7b131a11c
commit 7b4c105fdf

@ -14,14 +14,14 @@ fn main() -> NcResult<()> {
}
ncd.flush()?;
ncd.fg_rgb(0xff8080)?;
ncd.set_fg_rgb(0xff8080)?;
ncd.styles_on(NCSTYLE_STANDOUT)?;
printf!(" erp erp \n");
ncd.fg_rgb(0x80ff80)?;
ncd.set_fg_rgb(0x80ff80)?;
printf!(" erp erp \n");
ncd.styles_off(NCSTYLE_STANDOUT)?;
printf!(" erp erp \n");
ncd.fg_rgb(0xff8080)?;
ncd.set_fg_rgb(0xff8080)?;
printf!(" erp erp \n");
ncd.cursor_right(dimx / 2)?;
ncd.cursor_up(dimy / 2)?;

@ -5,18 +5,18 @@ use libnotcurses_sys::*;
fn main() -> NcResult<()> {
let ncd = NcDirect::new()?;
ncd.fg_rgb8(100, 100, 100)?;
ncd.bg_rgb8(0xff, 0xff, 0xff)?;
ncd.set_fg_rgb8(100, 100, 100)?;
ncd.set_bg_rgb8(0xff, 0xff, 0xff)?;
printf!("a");
ncd.bg_rgb8(0, 0, 0)?;
ncd.set_bg_rgb8(0, 0, 0)?;
printf!("b");
printf!(" ");
printf!(" ");
ncd.bg_rgb8(0, 0, 1)?;
ncd.set_bg_rgb8(0, 0, 1)?;
printf!("c");
printf!(" ");
printf!(" ");
ncd.bg_rgb8(0xff, 0xff, 0xff)?;
ncd.set_bg_rgb8(0xff, 0xff, 0xff)?;
printf!("d");
printf!("\n");
ncd.stop()?;

@ -126,15 +126,15 @@ impl NcDirect {
impl NcDirect {
/// Sets the foreground [NcPaletteIndex].
///
/// *C style function: [ncdirect_fg_palindex()][crate::ncdirect_fg_palindex].*
pub fn fg_palindex(&mut self, index: NcPaletteIndex) -> NcResult<()> {
/// *C style function: [ncdirect_set_fg_palindex()][crate::ncdirect_set_fg_palindex].*
pub fn set_fg_palindex(&mut self, index: NcPaletteIndex) -> NcResult<()> {
error![unsafe { crate::ncdirect_set_fg_palindex(self, index as i32) }]
}
/// Sets the background [NcPaletteIndex].
///
/// *C style function: [ncdirect_bg_palindex()][crate::ncdirect_bg_palindex].*
pub fn bg_palindex(&mut self, index: NcPaletteIndex) -> NcResult<()> {
/// *C style function: [ncdirect_set_bg_palindex()][crate::ncdirect_set_bg_palindex].*
pub fn set_bg_palindex(&mut self, index: NcPaletteIndex) -> NcResult<()> {
error![unsafe { crate::ncdirect_set_bg_palindex(self, index as i32) }]
}
@ -154,30 +154,30 @@ impl NcDirect {
/// Sets the foreground [NcRgb].
///
/// *C style function: [ncdirect_fg_rgb()][crate::ncdirect_fg_rgb].*
pub fn fg_rgb(&mut self, rgb: NcRgb) -> NcResult<()> {
/// *C style function: [ncdirect_set_fg_rgb()][crate::ncdirect_set_fg_rgb].*
pub fn set_fg_rgb(&mut self, rgb: NcRgb) -> NcResult<()> {
error![unsafe { crate::ncdirect_set_fg_rgb(self, rgb) }]
}
/// Sets the background [NcRgb].
///
/// *C style function: [ncdirect_bg_rgb()][crate::ncdirect_bg_rgb].*
pub fn bg_rgb(&mut self, rgb: NcRgb) -> NcResult<()> {
/// *C style function: [ncdirect_set_bg_rgb()][crate::ncdirect_set_bg_rgb].*
pub fn set_bg_rgb(&mut self, rgb: NcRgb) -> NcResult<()> {
error![unsafe { crate::ncdirect_set_bg_rgb(self, rgb) }]
}
/// Sets the foreground [NcColor] components.
///
/// *C style function: [ncdirect_fg_rgb8()][crate::ncdirect_fg_rgb8].*
pub fn fg_rgb8(&mut self, red: NcColor, green: NcColor, blue: NcColor) -> NcResult<()> {
error![crate::ncdirect_fg_rgb8(self, red, green, blue)]
/// *C style function: [ncdirect_set_fg_rgb8()][crate::ncdirect_set_fg_rgb8].*
pub fn set_fg_rgb8(&mut self, red: NcColor, green: NcColor, blue: NcColor) -> NcResult<()> {
error![crate::ncdirect_set_fg_rgb8(self, red, green, blue)]
}
/// Sets the background [NcColor] components.
///
/// *C style function: [ncdirect_bg_rgb()][crate::ncdirect_bg_rgb].*
pub fn bg_rgb8(&mut self, red: NcColor, green: NcColor, blue: NcColor) -> NcResult<()> {
error![crate::ncdirect_bg_rgb8(self, red, green, blue)]
/// *C style function: [ncdirect_set_bg_rgb()][crate::ncdirect_set_bg_rgb].*
pub fn set_bg_rgb8(&mut self, red: NcColor, green: NcColor, blue: NcColor) -> NcResult<()> {
error![crate::ncdirect_set_bg_rgb8(self, red, green, blue)]
}
/// Removes the specified styles.
@ -204,15 +204,15 @@ impl NcDirect {
/// Indicates to use the "default color" for the foreground.
///
/// *C style function: [ncdirect_fg_default()][crate::ncdirect_fg_default].*
pub fn fg_default(&mut self) -> NcResult<()> {
/// *C style function: [ncdirect_set_fg_default()][crate::ncdirect_set_fg_default].*
pub fn set_fg_default(&mut self) -> NcResult<()> {
error![unsafe { crate::ncdirect_set_fg_default(self) }]
}
/// Indicates to use the "default color" for the background.
///
/// *C style function: [ncdirect_bg_default()][crate::ncdirect_bg_default].*
pub fn bg_default(&mut self) -> NcResult<()> {
/// *C style function: [ncdirect_set_bg_default()][crate::ncdirect_set_bg_default].*
pub fn set_bg_default(&mut self) -> NcResult<()> {
error![unsafe { crate::ncdirect_set_bg_default(self) }]
}
}

@ -35,9 +35,9 @@ pub fn ncdirect_getc_nblocking(nc: &mut NcDirect, input: &mut NcInput) -> char {
/// Sets the foreground [NcColor] components.
///
/// *Method: NcDirect.[fg_rgb8()][NcDirect#method.getc_fg_rgb8].*
/// *Method: NcDirect.[set_fg_rgb8()][NcDirect#method.set_fg_rgb8].*
#[inline]
pub fn ncdirect_fg_rgb8(
pub fn ncdirect_set_fg_rgb8(
ncd: &mut NcDirect,
red: NcColor,
green: NcColor,
@ -49,9 +49,9 @@ pub fn ncdirect_fg_rgb8(
/// Sets the background [NcColor] components.
///
/// *Method: NcDirect.[bg_rgb8()][NcDirect#method.getc_bg_rgb8].*
/// *Method: NcDirect.[set_bg_rgb8()][NcDirect#method.set_bg_rgb8].*
#[inline]
pub fn ncdirect_bg_rgb8(
pub fn ncdirect_set_bg_rgb8(
ncd: &mut NcDirect,
red: NcColor,
green: NcColor,

Loading…
Cancel
Save