pub struct ScreenContext<'a, W: Write = Stdout> { /* private fields */ }Expand description
Context guard for alternate screen mode.
This struct provides RAII semantics for alternate screen operations. When dropped, it automatically leaves alternate screen mode and restores the cursor if it was hidden.
Use Console::screen() to create a ScreenContext.
Implementations§
Source§impl<'a, W: Write> ScreenContext<'a, W>
impl<'a, W: Write> ScreenContext<'a, W>
Sourcepub fn update<R: Renderable + 'static>(&mut self, renderable: R) -> Result<()>
pub fn update<R: Renderable + 'static>(&mut self, renderable: R) -> Result<()>
Sourcepub fn update_with_style<R: Renderable + 'static>(
&mut self,
renderable: R,
style: Option<Style>,
) -> Result<()>
pub fn update_with_style<R: Renderable + 'static>( &mut self, renderable: R, style: Option<Style>, ) -> Result<()>
Update the screen with new content and optional style override.
§Arguments
renderable- The content to display on the screen.style- Optional style override for the screen background.
Sourcepub fn update_many<I, R>(&mut self, renderables: I) -> Result<()>where
I: IntoIterator<Item = R>,
R: Renderable + 'static,
pub fn update_many<I, R>(&mut self, renderables: I) -> Result<()>where
I: IntoIterator<Item = R>,
R: Renderable + 'static,
Update the screen with multiple renderables.
The renderables are grouped together and rendered as a single unit.
§Arguments
renderables- Iterator of renderables to display.
Sourcepub fn update_many_with_style<I, R>(
&mut self,
renderables: I,
style: Option<Style>,
) -> Result<()>where
I: IntoIterator<Item = R>,
R: Renderable + 'static,
pub fn update_many_with_style<I, R>(
&mut self,
renderables: I,
style: Option<Style>,
) -> Result<()>where
I: IntoIterator<Item = R>,
R: Renderable + 'static,
Update the screen with multiple renderables and optional style.
§Arguments
renderables- Iterator of renderables to display.style- Optional style override for the screen background.
Sourcepub fn set_style(&mut self, style: Option<Style>)
pub fn set_style(&mut self, style: Option<Style>)
Set the default style for the screen.
This style will be used for all subsequent update() calls unless
overridden with update_with_style().
Sourcepub fn console_mut(&mut self) -> &mut Console<W>
pub fn console_mut(&mut self) -> &mut Console<W>
Get a mutable reference to the underlying console.
Trait Implementations§
Auto Trait Implementations§
impl<'a, W> Freeze for ScreenContext<'a, W>
impl<'a, W = Stdout> !RefUnwindSafe for ScreenContext<'a, W>
impl<'a, W> Send for ScreenContext<'a, W>where
W: Send,
impl<'a, W> Sync for ScreenContext<'a, W>where
W: Sync,
impl<'a, W> Unpin for ScreenContext<'a, W>
impl<'a, W = Stdout> !UnwindSafe for ScreenContext<'a, W>
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