pub struct StreamWriter { /* private fields */ }Expand description
A streaming answer under construction, the bus’s completion writer.
Obtained by Reply::written; finish ends the reply
with the response it folds into, while a writer dropped without it
leaves a truncated stream.
Implementations§
Source§impl StreamWriter
impl StreamWriter
Sourcepub async fn text(&mut self, text: impl Into<String>) -> Result<(), SinkClosed>
pub async fn text(&mut self, text: impl Into<String>) -> Result<(), SinkClosed>
A text fragment: extends the open text part, or opens one after closing an open reasoning part.
Sourcepub async fn reasoning(
&mut self,
text: impl Into<String>,
) -> Result<(), SinkClosed>
pub async fn reasoning( &mut self, text: impl Into<String>, ) -> Result<(), SinkClosed>
A reasoning fragment: extends the open reasoning part, or opens one after closing an open text part.
Sourcepub async fn tool_call(
&mut self,
name: impl Into<String>,
arguments: Value,
) -> Result<(), SinkClosed>
pub async fn tool_call( &mut self, name: impl Into<String>, arguments: Value, ) -> Result<(), SinkClosed>
A whole tool call, under an id rig issues.
Sourcepub fn request_id(&mut self, request_id: impl Into<String>)
pub fn request_id(&mut self, request_id: impl Into<String>)
The provider’s transport request id, the response’s
provider_request_id: what a writer relaying a provider’s reply
reports in place of a transport. An empty id is no id.
Sourcepub async fn error(&mut self, report: ErrorReport) -> Result<(), SinkClosed>
pub async fn error(&mut self, report: ErrorReport) -> Result<(), SinkClosed>
An in-band error: the consumer’s last item.
Auto Trait Implementations§
impl !RefUnwindSafe for StreamWriter
impl !UnwindSafe for StreamWriter
impl Freeze for StreamWriter
impl Send for StreamWriter
impl Sync for StreamWriter
impl Unpin for StreamWriter
impl UnsafeUnpin for StreamWriter
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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