pub struct AnsiRenderer { /* private fields */ }
Expand description
Renderer with deferred output buffering
Implementations§
Source§impl AnsiRenderer
impl AnsiRenderer
Sourcepub fn with_inline_ui(
handle: InlineHandle,
highlight_config: SyntaxHighlightingConfig,
) -> Self
pub fn with_inline_ui( handle: InlineHandle, highlight_config: SyntaxHighlightingConfig, ) -> Self
Create a renderer that forwards output to the inline UI session handle
Sourcepub fn set_highlight_config(&mut self, config: SyntaxHighlightingConfig)
pub fn set_highlight_config(&mut self, config: SyntaxHighlightingConfig)
Override the syntax highlighting configuration.
Sourcepub fn was_previous_line_empty(&self) -> bool
pub fn was_previous_line_empty(&self) -> bool
Check if the last line rendered was empty
pub fn supports_streaming_markdown(&self) -> bool
Sourcepub fn prefers_untruncated_output(&self) -> bool
pub fn prefers_untruncated_output(&self) -> bool
Determine whether the renderer is connected to the inline UI.
Inline rendering uses the terminal session scrollback, so tool output should avoid truncation that would otherwise be applied in compact CLI mode.
Sourcepub fn flush(&mut self, style: MessageStyle) -> Result<()>
pub fn flush(&mut self, style: MessageStyle) -> Result<()>
Flush the buffer with the given style
Sourcepub fn line(&mut self, style: MessageStyle, text: &str) -> Result<()>
pub fn line(&mut self, style: MessageStyle, text: &str) -> Result<()>
Convenience for writing a single line
Sourcepub fn inline_with_style(
&mut self,
style: MessageStyle,
text: &str,
) -> Result<()>
pub fn inline_with_style( &mut self, style: MessageStyle, text: &str, ) -> Result<()>
Write styled text without a trailing newline
Sourcepub fn line_with_style(&mut self, style: Style, text: &str) -> Result<()>
pub fn line_with_style(&mut self, style: Style, text: &str) -> Result<()>
Write a line with an explicit style
Sourcepub fn line_if_not_empty(&mut self, style: MessageStyle) -> Result<()>
pub fn line_if_not_empty(&mut self, style: MessageStyle) -> Result<()>
Write an empty line only if the previous line was not empty
pub fn stream_markdown_response( &mut self, text: &str, previous_line_count: usize, ) -> Result<usize>
Auto Trait Implementations§
impl Freeze for AnsiRenderer
impl RefUnwindSafe for AnsiRenderer
impl Send for AnsiRenderer
impl Sync for AnsiRenderer
impl Unpin for AnsiRenderer
impl UnwindSafe for AnsiRenderer
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: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more