pub struct Screen { /* private fields */ }Expand description
A renderable that fills the terminal screen and crops excess.
Screen renders its content to fill the full terminal dimensions, cropping any excess and padding if needed.
§Example
use rich_rs::{Console, Text};
use rich_rs::screen::Screen;
let text = Text::plain("Hello, World!");
let screen = Screen::new(text);Implementations§
Source§impl Screen
impl Screen
Sourcepub fn new(renderable: impl Renderable + 'static) -> Self
pub fn new(renderable: impl Renderable + 'static) -> Self
Create a new Screen with a renderable.
Sourcepub fn new_many<I, R>(renderables: I) -> Selfwhere
I: IntoIterator<Item = R>,
R: Renderable + 'static,
pub fn new_many<I, R>(renderables: I) -> Selfwhere
I: IntoIterator<Item = R>,
R: Renderable + 'static,
Create a new Screen from multiple renderables.
Python Rich’s Screen(*renderables) wraps the inputs in Group.
This is the closest Rust equivalent.
Sourcepub fn from_arc(renderable: Arc<dyn Renderable>) -> Self
pub fn from_arc(renderable: Arc<dyn Renderable>) -> Self
Create a new Screen from an Arc<dyn Renderable>.
This avoids an extra Arc allocation when you already have one.
Sourcepub fn with_style(self, style: impl Into<Style>) -> Self
pub fn with_style(self, style: impl Into<Style>) -> Self
Set the background style.
Sourcepub fn with_application_mode(self, mode: bool) -> Self
pub fn with_application_mode(self, mode: bool) -> Self
Enable application mode (uses \n\r newlines).
Application mode is typically used when the terminal is in alternate
screen mode, where \n\r provides correct cursor positioning.
Trait Implementations§
Source§impl Renderable for Screen
impl Renderable for Screen
Source§fn render(&self, console: &Console, options: &ConsoleOptions) -> Segments
fn render(&self, console: &Console, options: &ConsoleOptions) -> Segments
Render this object to a sequence of segments.
Source§fn measure(&self, console: &Console, options: &ConsoleOptions) -> Measurement
fn measure(&self, console: &Console, options: &ConsoleOptions) -> Measurement
Measure the minimum and maximum width requirements. Read more
Auto Trait Implementations§
impl Freeze for Screen
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