pub struct Console { /* private fields */ }Expand description
The main console type for rich terminal output.
Implementations§
Source§impl Console
impl Console
Sourcepub fn capture() -> Self
pub fn capture() -> Self
Create a new Console that captures output to memory.
Useful for testing output verification.
Sourcepub fn get_captured_output(&self) -> String
pub fn get_captured_output(&self) -> String
Get the captured output as a string (if using capture mode).
Sourcepub fn force_color(self, force: bool) -> Self
pub fn force_color(self, force: bool) -> Self
Force color output even when not detected.
Sourcepub fn color_system(self, system: ColorSystem) -> Self
pub fn color_system(self, system: ColorSystem) -> Self
Set the color system explicitly.
Sourcepub fn start_recording(&self)
pub fn start_recording(&self)
Start recording output.
Sourcepub fn stop_recording(&self)
pub fn stop_recording(&self)
Stop recording output.
Sourcepub fn print_renderable(&self, renderable: &dyn Renderable)
pub fn print_renderable(&self, renderable: &dyn Renderable)
Print any renderable object.
Sourcepub fn print_raw(&self, content: &str)
pub fn print_raw(&self, content: &str)
Print a string without markup parsing.
Use this when printing content that may contain brackets [...]
that should NOT be interpreted as markup (e.g., debug output).
Sourcepub fn println_raw(&self, content: &str)
pub fn println_raw(&self, content: &str)
Print a line without markup parsing (with newline at the end).
Use this when printing content that may contain brackets [...]
that should NOT be interpreted as markup (e.g., debug output).
Sourcepub fn show_cursor(&self, show: bool)
pub fn show_cursor(&self, show: bool)
Show or hide the cursor.
Sourcepub fn move_cursor_up(&self, n: u16)
pub fn move_cursor_up(&self, n: u16)
Move the cursor up by n lines.
Sourcepub fn move_cursor_down(&self, n: u16)
pub fn move_cursor_down(&self, n: u16)
Move the cursor down by n lines.
Sourcepub fn clear_line(&self)
pub fn clear_line(&self)
Clear the current line.
Sourcepub fn print_debug<T: Debug>(&self, obj: &T)
pub fn print_debug<T: Debug>(&self, obj: &T)
Pretty print a debug-printable object.
Uses syntax highlighting if the syntax feature is enabled.
Sourcepub fn export_text(&self, renderable: &dyn Renderable) -> String
pub fn export_text(&self, renderable: &dyn Renderable) -> String
Export a renderable as plain text.
Returns the plain text representation without any ANSI codes.
Sourcepub fn export_html(&self, renderable: &dyn Renderable) -> String
pub fn export_html(&self, renderable: &dyn Renderable) -> String
Export a renderable as HTML with inline styles.
Returns an HTML string with styled <span> elements.
Sourcepub fn export_svg(&self, renderable: &dyn Renderable) -> String
pub fn export_svg(&self, renderable: &dyn Renderable) -> String
Export a renderable as SVG.
Returns an SVG string with text elements.