pub struct ConsoleRenderer { /* private fields */ }Expand description
Console renderer for terminal output.
Renders IOOutput messages to the terminal using appropriate
formatting and logging.
Implementations§
Source§impl ConsoleRenderer
impl ConsoleRenderer
Sourcepub fn set_verbose(&mut self, verbose: bool)
pub fn set_verbose(&mut self, verbose: bool)
Sets verbose mode.
Sourcepub fn is_verbose(&self) -> bool
pub fn is_verbose(&self) -> bool
Returns true if verbose mode is enabled.
Sourcepub fn render_output(&self, output: &IOOutput)
pub fn render_output(&self, output: &IOOutput)
Renders a single output to the console.
This is the core rendering logic that can be called directly
or used within the run loop.
Sourcepub async fn run(self, output_handle: IOOutputHandle)
pub async fn run(self, output_handle: IOOutputHandle)
Runs the renderer loop, consuming output from the handle.
This is typically spawned as a background task. The loop runs until the handle is closed (IOPort dropped).
§Example
use orcs_runtime::io::{IOPort, ConsoleRenderer};
use orcs_types::ChannelId;
#[tokio::main]
async fn main() {
let channel_id = ChannelId::new();
let (port, _input_handle, output_handle) = IOPort::with_defaults(channel_id);
let renderer = ConsoleRenderer::new();
tokio::spawn(renderer.run(output_handle));
}Sourcepub fn drain_and_render(&self, output_handle: &mut IOOutputHandle) -> usize
pub fn drain_and_render(&self, output_handle: &mut IOOutputHandle) -> usize
Drains and renders all available output without blocking.
Returns the number of outputs rendered.
Trait Implementations§
Source§impl Debug for ConsoleRenderer
impl Debug for ConsoleRenderer
Auto Trait Implementations§
impl Freeze for ConsoleRenderer
impl RefUnwindSafe for ConsoleRenderer
impl Send for ConsoleRenderer
impl Sync for ConsoleRenderer
impl Unpin for ConsoleRenderer
impl UnsafeUnpin for ConsoleRenderer
impl UnwindSafe for ConsoleRenderer
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