pub struct Notcurses { /* private fields */ }Expand description
Notcurses state for a given terminal, composed of Planes.
There can only be a single Notcurses instance per thread at any given moment.
Implementations§
Source§impl Notcurses
impl Notcurses
Sourcepub fn is_initialized() -> bool
pub fn is_initialized() -> bool
Returns true if there’s already a notcurses instance initialized in this thread.
Source§impl Notcurses
§constructors & deconstructors.
impl Notcurses
§constructors & deconstructors.
Returns a new Notcurses context, with banners.
Returns a new Notcurses context in CLI mode, with banners.
Sourcepub fn with_nc_mut<F, R>(&self, f: F) -> R
pub fn with_nc_mut<F, R>(&self, f: F) -> R
Safely access the mutable Nc reference.
Source§impl Notcurses
§event methods
impl Notcurses
§event methods
Sourcepub fn refresh(&self) -> Result<(u32, u32)>
pub fn refresh(&self) -> Result<(u32, u32)>
Refreshes the physical screen to match what was last rendered (i.e.,
without reflecting any changes since the last call to
render).
Returns the current screen geometry (y, x).
This is primarily useful if the screen is externally corrupted, or if a resize] event has been read and you’re not yet ready to render.
Sourcepub fn mice_enable(&self, input: MiceEvents) -> Result<()>
pub fn mice_enable(&self, input: MiceEvents) -> Result<()>
Enables receiving the provided mice events.
Sourcepub fn mice_disable(&self) -> Result<()>
pub fn mice_disable(&self) -> Result<()>
Disables receiving the mice events.
Sourcepub fn poll_event(&self) -> Result<Input>
pub fn poll_event(&self) -> Result<Input>
Tries to get an event, non blocking.
Source§impl Notcurses
§general query methods
impl Notcurses
§general query methods
Sourcepub fn geometry_best(&self) -> PlaneGeometry
pub fn geometry_best(&self) -> PlaneGeometry
Sourcepub fn geometry_try(&self, blitter: Blitter) -> Option<PlaneGeometry>
pub fn geometry_try(&self, blitter: Blitter) -> Option<PlaneGeometry>
Returns the terminal geometry using the requested blitter, if available.
Sourcepub fn geometry_first(&self, blitters: &[Blitter]) -> Option<PlaneGeometry>
pub fn geometry_first(&self, blitters: &[Blitter]) -> Option<PlaneGeometry>
Returns the first terminal geometry available from the provided list.
Sourcepub fn geometries_all(&self, blitters: &[Blitter]) -> Vec<PlaneGeometry>
pub fn geometries_all(&self, blitters: &[Blitter]) -> Vec<PlaneGeometry>
Returns all the availeble terminal geometries from the provided list.
Sourcepub fn visual_geometry(&self, visual: &Visual) -> Result<VisualGeometry>
pub fn visual_geometry(&self, visual: &Visual) -> Result<VisualGeometry>
Returns the visual geometry of a visual.
Sourcepub fn capabilities(&self) -> Capabilities
pub fn capabilities(&self) -> Capabilities
Returns the capabilities of the terminal.
Sourcepub fn supported_styles(&self) -> Style
pub fn supported_styles(&self) -> Style
Returns an Style with the supported curses-style attributes.
The attribute is only indicated as supported if the terminal can support it together with color.
Sourcepub fn default_background(&self) -> Option<Rgb>
pub fn default_background(&self) -> Option<Rgb>
Returns the default background color, if it is known.
Sourcepub fn default_foreground(&self) -> Option<Rgb>
pub fn default_foreground(&self) -> Option<Rgb>
Returns the default foreground color, if it is known.
Sourcepub fn version() -> String
pub fn version() -> String
Returns a human-readable string describing the running notcurses version.
Sourcepub fn version_components() -> (u32, u32, u32, u32)
pub fn version_components() -> (u32, u32, u32, u32)
Returns the running notcurses version components (major, minor, patch, tweak).
Sourcepub fn accountname() -> String
pub fn accountname() -> String
Returns the name of the user under which we are running.
Sourcepub fn detected_terminal(&self) -> String
pub fn detected_terminal(&self) -> String
Returns the name of the detected terminal.
Source§impl Notcurses
§settings methods
impl Notcurses
§settings methods
Sourcepub fn cursor_disable(&self) -> Result<()>
pub fn cursor_disable(&self) -> Result<()>
Disables the terminal’s cursor.
Sourcepub fn cursor_enable(&self, position: impl Into<Position>) -> Result<()>
pub fn cursor_enable(&self, position: impl Into<Position>) -> Result<()>
Enables the terminal’s cursor, if available, placing it at position.
Sourcepub fn leave_alternate_screen(&mut self) -> Result<()>
pub fn leave_alternate_screen(&mut self) -> Result<()>
Leaves the alternate screen.
Sourcepub fn enter_alternate_screen(&mut self) -> Result<()>
pub fn enter_alternate_screen(&mut self) -> Result<()>
Enters the alternate screen, if available.
Entering the alternate screen turns off scrolling for the CLI plane.
Sourcepub fn signals_disable(&mut self) -> Result<()>
pub fn signals_disable(&mut self) -> Result<()>
Disables signals originating from the terminal’s line discipline, i.e. SIGINT (^C), SIGQUIT (^), and SIGTSTP (^Z). They are enabled by default.
Sourcepub fn signals_enable(&mut self) -> Result<()>
pub fn signals_enable(&mut self) -> Result<()>
Restores signals originating from the terminal’s line discipline, i.e. SIGINT (^C), SIGQUIT (^), and SIGTSTP (^Z), if disabled.
Source§impl Notcurses
§statistics methods
impl Notcurses
§statistics methods
Sourcepub fn statistics(&mut self) -> Statistics
pub fn statistics(&mut self) -> Statistics
Allocates a Statistics object.
Sourcepub fn statistics_reset(&mut self, stats: Statistics)
pub fn statistics_reset(&mut self, stats: Statistics)
Resets all cumulative statistics.
Immediate ones, such as fbbytes, are not reset.
Sourcepub fn statistics_update(&mut self, stats: Statistics)
pub fn statistics_update(&mut self, stats: Statistics)
Acquires an atomic snapshot of the notcurses statistics.