pub struct StreamRefProtoProducer<T>where
T: StreamRefPayload,{ /* private fields */ }Expand description
Producer-side endpoint for a local SourceRef or Source.
Feed inbound OnSubscribeHandshake, CumulativeDemand, cancellation, and
Ack frames with StreamRefProtoEndpoint::handle_frame. Drain outbound
SequencedOnNext, completion, failure, and Ack frames with
StreamRefProtoEndpoint::next_frame.
Implementations§
Source§impl<T> StreamRefProtoProducer<T>where
T: StreamRefPayload,
impl<T> StreamRefProtoProducer<T>where
T: StreamRefPayload,
pub fn from_source_ref( source_ref: SourceRef<T>, stream_ref_id: StreamRefId, settings: StreamRefSettings, ) -> StreamResult<Self>
pub fn from_source<Mat>(
source: Source<T, Mat>,
stream_ref_id: StreamRefId,
settings: StreamRefSettings,
) -> StreamResult<Self>where
Mat: Send + 'static,
Sourcepub fn new_lazy(stream_ref_id: StreamRefId, settings: StreamRefSettings) -> Self
pub fn new_lazy(stream_ref_id: StreamRefId, settings: StreamRefSettings) -> Self
Creates a producer with no attached input, for the SinkRef sender side.
The input stream is attached later by materializing the Sink
returned from StreamRefProtoProducer::sink. Until then, the
producer’s next_frame waits on the condvar instead of spinning, so an
idle lazy producer does not busy-loop while the remote consumer has not
yet subscribed or attached demand.
Sourcepub fn sink(&self) -> Sink<T, StreamCompletion<NotUsed>>
pub fn sink(&self) -> Sink<T, StreamCompletion<NotUsed>>
Returns a Sink whose incoming elements are framed and sent as this
producer’s outbound SequencedOnNext frames.
Materializing the sink attaches the input stream to the lazy producer
and returns a StreamCompletion that resolves when the producer
reaches its terminal state (all elements sent and acknowledged, the
remote cancelled/failed, or the carrier failed).