pub struct Screen {
pub wipe: bool,
pub true_color: bool,
/* private fields */
}
Expand description
Terminal screen buffer
It helps prevent unnecessary trafic to the terminal:
- collect all the painting in one cycle, then print the result
- print only the diff between last and new cycle
You probably won’t use it directly and instead use the crate::Painter
.
If you do, however, it should be fairly straightforward.
Fields§
§wipe: bool
§true_color: bool
Implementations§
source§impl Screen
impl Screen
pub fn resize(&mut self, size: Point)
pub fn size(&self) -> Point
sourcepub fn set_last_write(&mut self, pos: Point)
pub fn set_last_write(&mut self, pos: Point)
Set the position of the last write
sourcepub fn last_write(&self) -> Option<Point>
pub fn last_write(&self) -> Option<Point>
Get the position of the last write
sourcepub fn get(&self, point: Point) -> Option<(&ScreenStyle, &str)>
pub fn get(&self, point: Point) -> Option<(&ScreenStyle, &str)>
Get a symbol at given coordinates
If the coordinates are out of bounds or if the symbol is not set you get None
sourcepub fn get_idx(&self, idx: usize) -> Option<(&ScreenStyle, &str)>
pub fn get_idx(&self, idx: usize) -> Option<(&ScreenStyle, &str)>
Get a symbol at given order index
If the coordinates are out of bounds or if the symbol is not set you get None
sourcepub fn set(
&mut self,
point: Point,
style: impl Into<ScreenStyle>,
symbol: impl AsRef<str>
)
pub fn set( &mut self, point: Point, style: impl Into<ScreenStyle>, symbol: impl AsRef<str> )
Set a symbol at given coordinates
If the coordinates are out of bounds the symbol is ignored
sourcepub fn set_idx(
&mut self,
idx: usize,
style: impl Into<ScreenStyle>,
symbol: impl AsRef<str>
)
pub fn set_idx( &mut self, idx: usize, style: impl Into<ScreenStyle>, symbol: impl AsRef<str> )
Set a symbol at given order index
If the coordinates are out of bounds the symbol is ignored
sourcepub fn symbols<'a>(
&'a self
) -> impl Iterator<Item = (Point, &'a ScreenStyle, &'a str)> + 'a
pub fn symbols<'a>( &'a self ) -> impl Iterator<Item = (Point, &'a ScreenStyle, &'a str)> + 'a
Dump all the currently set screen symbols
pub fn diffs<'a>( &'a mut self, scope: Option<Window>, refresh: bool ) -> impl Iterator<Item = (Point, &'a ScreenStyle, &'a str)>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Screen
impl Send for Screen
impl !Sync for Screen
impl Unpin for Screen
impl UnwindSafe for Screen
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more