pub struct StubStreamingTool { /* private fields */ }Expand description
Synthetic stream producer for testing the dispatcher’s streaming arm. Emits a deterministic 4-frame sequence per invocation:
ToolChunk::intermediate("[stub-stream] <name>(")
ToolChunk::intermediate(<args>)
ToolChunk::intermediate(")")
ToolChunk::terminator("", ToolFinishReason::Stop)Cancel-safe: between every chunk emission, the tool polls
ctx.cancel; if fired, the stream short-circuits to a
ToolFinishReason::Cancelled terminator chunk. The pre-cancel
chunks already emitted reach the consumer; the post-cancel
chunks are skipped. D5 p95 ≤100ms invariant honored at the
chunk boundary.
Implementations§
Trait Implementations§
Source§impl Tool for StubStreamingTool
impl Tool for StubStreamingTool
Source§fn execute<'life0, 'async_trait>(
&'life0 self,
args: String,
_ctx: ToolContext,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
args: String,
_ctx: ToolContext,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Execute the tool synchronously. Returns a single materialized
ToolResult. EVERY tool MUST implement this method
(no default — there’s no sensible default execute).Source§fn stream<'life0, 'async_trait>(
&'life0 self,
args: String,
ctx: ToolContext,
) -> Pin<Box<dyn Future<Output = ToolStream> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stream<'life0, 'async_trait>(
&'life0 self,
args: String,
ctx: ToolContext,
) -> Pin<Box<dyn Future<Output = ToolStream> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn is_streaming(&self) -> bool
fn is_streaming(&self) -> bool
Whether this tool is a stream producer. Default:
false. Read moreAuto Trait Implementations§
impl Freeze for StubStreamingTool
impl RefUnwindSafe for StubStreamingTool
impl Send for StubStreamingTool
impl Sync for StubStreamingTool
impl Unpin for StubStreamingTool
impl UnsafeUnpin for StubStreamingTool
impl UnwindSafe for StubStreamingTool
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 moreCreates a shared type from an unshared type.