pub struct ConversationStreamSubscription { /* private fields */ }Expand description
Bridges a conversation event [Stream] to a Reactive-Streams-style consumer
with real backpressure, matching java.util.concurrent.Flow.Subscription’s
request(n)/cancel() contract. Only Java’s Flow.Publisher exposure
needs this — every other binding either pulls synchronously
(conversation_stream_iter) or has no flow control at all
(drive_conversation_stream).
Implementations§
Source§impl ConversationStreamSubscription
impl ConversationStreamSubscription
Sourcepub fn spawn<S, F1, F2, F3>(
stream: S,
on_next: F1,
on_error: F2,
on_complete: F3,
) -> Self
pub fn spawn<S, F1, F2, F3>( stream: S, on_next: F1, on_error: F2, on_complete: F3, ) -> Self
Spawn a background task that waits for demand, pulls one item at a time
from stream once demand is available, and dispatches
on_next/on_error/on_complete (each of these is expected to call
back into the JVM via a JNI Subscriber reference).
Drains all the way to the stream’s natural end rather than stopping as
soon as a ConversationStreamEvent::WorkflowFinished is seen —
against the real API, the server sometimes emits a few more
housekeeping events (e.g. a chat_title_updated-shaped
ConversationStreamEvent::Other) after workflow_finished and
before actually closing the connection, so stopping early would
silently drop them and abandon the connection while the server still
had something to say.
Auto Trait Implementations§
impl Freeze for ConversationStreamSubscription
impl RefUnwindSafe for ConversationStreamSubscription
impl Send for ConversationStreamSubscription
impl Sync for ConversationStreamSubscription
impl Unpin for ConversationStreamSubscription
impl UnsafeUnpin for ConversationStreamSubscription
impl UnwindSafe for ConversationStreamSubscription
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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