mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-20 03:25:47 +00:00
rust: 2+ notcurses convenience constructors
This commit is contained in:
parent
08b000de28
commit
2e47618a6a
@ -65,7 +65,7 @@ use crate::{
|
|||||||
notcurses_stdplane_const,
|
notcurses_stdplane_const,
|
||||||
types::{
|
types::{
|
||||||
NcAlign, NcInput, NcLogLevel, NcPlane, Notcurses, NotcursesOptions, NCALIGN_CENTER,
|
NcAlign, NcInput, NcLogLevel, NcPlane, Notcurses, NotcursesOptions, NCALIGN_CENTER,
|
||||||
NCALIGN_LEFT, NCOPTION_SUPPRESS_BANNERS,
|
NCALIGN_LEFT, NCOPTION_SUPPRESS_BANNERS, NCOPTION_NO_ALTERNATE_SCREEN,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -149,6 +149,19 @@ impl Notcurses {
|
|||||||
&mut *notcurses_init(&NotcursesOptions::new(), null_mut())
|
&mut *notcurses_init(&NotcursesOptions::new(), null_mut())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// `Notcurses` simple constructor without an alternate screen
|
||||||
|
pub unsafe fn without_altscreen<'a>() -> &'a mut Notcurses {
|
||||||
|
let options = NotcursesOptions::with_flags(NCOPTION_NO_ALTERNATE_SCREEN);
|
||||||
|
&mut *notcurses_init(&options, null_mut())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `Notcurses` simple constructor without an alternate screen
|
||||||
|
pub unsafe fn without_altscreen_nor_banners<'a>() -> &'a mut Notcurses {
|
||||||
|
let options = NotcursesOptions::with_flags(
|
||||||
|
NCOPTION_NO_ALTERNATE_SCREEN | NCOPTION_SUPPRESS_BANNERS);
|
||||||
|
&mut *notcurses_init(&options, null_mut())
|
||||||
|
}
|
||||||
|
|
||||||
/// `Notcurses` constructor with options
|
/// `Notcurses` constructor with options
|
||||||
pub unsafe fn with_options<'a>(options: &NotcursesOptions) -> &'a mut Notcurses {
|
pub unsafe fn with_options<'a>(options: &NotcursesOptions) -> &'a mut Notcurses {
|
||||||
&mut *notcurses_init(options, null_mut())
|
&mut *notcurses_init(options, null_mut())
|
||||||
|
Loading…
Reference in New Issue
Block a user