pub struct TerminalStreamer { /* private fields */ }
Expand description
Terminal streamer for displaying streaming tokens
Implementations§
Source§impl TerminalStreamer
impl TerminalStreamer
Sourcepub fn with_config(config: TerminalStreamingConfig) -> Self
pub fn with_config(config: TerminalStreamingConfig) -> Self
Create a new terminal streamer with custom configuration
Sourcepub async fn stream_response<S>(
&mut self,
stream: S,
) -> Result<(String, Option<String>), Box<dyn Error>>
pub async fn stream_response<S>( &mut self, stream: S, ) -> Result<(String, Option<String>), Box<dyn Error>>
Stream response tokens to the terminal
This method consumes a stream of tokens and displays them in real-time. If animation is enabled, it will simulate typing by adding delays between characters. Returns the collected content and finish reason.
Auto Trait Implementations§
impl Freeze for TerminalStreamer
impl RefUnwindSafe for TerminalStreamer
impl Send for TerminalStreamer
impl Sync for TerminalStreamer
impl Unpin for TerminalStreamer
impl UnwindSafe for TerminalStreamer
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