pub struct TerminalPresenter { /* private fields */ }Expand description
Terminal presenter adapter
Renders command output to the terminal. In text mode, all output goes to stdout. In JSON
mode, messages go to stderr and artifacts are serialized as JSON to stdout. This follows the
convention used by gh, kubectl, and jq.
TerminalPresenter is constructed once via its builder, consumed by a single call to
present, and dropped when the command completes. The presenter holds the EventReceiver
alive during command execution so that EventSenders do not receive errors when sending.
After the command completes, the presenter and its receiver are dropped.
§Examples
use clawless_core::event::event_channel;
use clawless_cli::presenter::TerminalPresenter;
let (_sender, receiver) = event_channel();
let presenter = TerminalPresenter::builder().receiver(receiver).build();Implementations§
Source§impl TerminalPresenter
impl TerminalPresenter
Sourcepub fn builder() -> TerminalPresenterBuilder
pub fn builder() -> TerminalPresenterBuilder
Create an instance of TerminalPresenter using the builder syntax
Trait Implementations§
Source§impl Debug for TerminalPresenter
impl Debug for TerminalPresenter
Auto Trait Implementations§
impl Freeze for TerminalPresenter
impl RefUnwindSafe for TerminalPresenter
impl Send for TerminalPresenter
impl Sync for TerminalPresenter
impl Unpin for TerminalPresenter
impl UnsafeUnpin for TerminalPresenter
impl UnwindSafe for TerminalPresenter
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