pub struct Console { /* private fields */ }Expand description
Console for rendering styled output with terminal detection.
Implementations§
Source§impl Console
impl Console
Sourcepub fn with_writer<W: Write + Send + 'static>(writer: W) -> Self
pub fn with_writer<W: Write + Send + 'static>(writer: W) -> Self
Create a console that writes to the provided writer with auto-detected capabilities.
Sourcepub fn with_caps<W: Write + Send + 'static>(
writer: W,
caps: Capabilities,
color_mode: ColorMode,
) -> Self
pub fn with_caps<W: Write + Send + 'static>( writer: W, caps: Capabilities, color_mode: ColorMode, ) -> Self
Create a console with explicit capabilities and color mode.
Sourcepub fn capabilities(&self) -> &Capabilities
pub fn capabilities(&self) -> &Capabilities
Returns the detected terminal capabilities.
Sourcepub fn color_mode(&self) -> ColorMode
pub fn color_mode(&self) -> ColorMode
Returns the current color mode.
Sourcepub fn set_color_mode(&mut self, mode: ColorMode)
pub fn set_color_mode(&mut self, mode: ColorMode)
Set the color mode for subsequent renders.
Sourcepub fn print(&self, content: &dyn Render) -> Result<()>
pub fn print(&self, content: &dyn Render) -> Result<()>
Render content without a trailing newline.
Sourcepub fn println(&self, content: &dyn Render) -> Result<()>
pub fn println(&self, content: &dyn Render) -> Result<()>
Render content with a trailing newline.
Sourcepub fn cursor_hide(&self) -> Result<()>
pub fn cursor_hide(&self) -> Result<()>
Hide the cursor (no-op if ANSI output is disabled).
Sourcepub fn cursor_show(&self) -> Result<()>
pub fn cursor_show(&self) -> Result<()>
Show the cursor (no-op if ANSI output is disabled).
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Console
impl !RefUnwindSafe for Console
impl Send for Console
impl Sync for Console
impl Unpin for Console
impl UnsafeUnpin for Console
impl !UnwindSafe for Console
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).