mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-04 06:00:30 +00:00
rust: add stats methods
This commit is contained in:
parent
e822e85a14
commit
5def609c73
@ -35,6 +35,7 @@ mod notcurses;
|
||||
mod palette;
|
||||
mod pixel;
|
||||
mod plane;
|
||||
mod stats;
|
||||
mod time;
|
||||
mod visual;
|
||||
mod widgets;
|
||||
@ -53,6 +54,7 @@ pub use notcurses::*;
|
||||
pub use palette::*;
|
||||
pub use pixel::*;
|
||||
pub use plane::*;
|
||||
pub use stats::*;
|
||||
pub use time::*;
|
||||
pub use visual::*;
|
||||
pub use widgets::*;
|
||||
|
25
rust/src/stats.rs
Normal file
25
rust/src/stats.rs
Normal file
@ -0,0 +1,25 @@
|
||||
//! `NcStats`
|
||||
|
||||
use crate::Notcurses;
|
||||
|
||||
/// notcurses runtime statistics
|
||||
pub type NcStats = crate::bindings::bindgen::ncstats;
|
||||
|
||||
/// # `NcStats` Methods.
|
||||
impl NcStats {
|
||||
|
||||
/// Allocates an NcStats object.
|
||||
pub fn new<'a>(nc: &'a Notcurses) -> &'a mut Self {
|
||||
unsafe { &mut *crate::notcurses_stats_alloc(nc) }
|
||||
}
|
||||
|
||||
/// Acquires an atomic snapshot of the Notcurses object's stats.
|
||||
pub fn stats(&mut self, nc: &Notcurses) {
|
||||
unsafe { crate::notcurses_stats(nc, self) }
|
||||
}
|
||||
|
||||
/// Resets all cumulative stats (immediate ones are not reset).
|
||||
pub fn reset(&mut self, nc: &mut Notcurses) {
|
||||
unsafe { crate::notcurses_stats_reset(nc, self) }
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
//! `NcStats` widget types
|
||||
|
||||
/// notcurses runtime statistics
|
||||
pub type NcStats = crate::bindings::bindgen::ncstats;
|
Loading…
Reference in New Issue
Block a user