pub struct SingleSubscriberOutputStream<D = LossyWithoutBackpressure, R = NoReplay>{ /* private fields */ }Expand description
The output stream from a process. Either representing stdout or stderr.
This is the single-subscriber variant, allowing exactly one active consumer at a time. It is
useful when one inspector, collector, or line waiter should own the stream and accidental
concurrent fanout should be rejected early. It can reduce coordination overhead in some
single-consumer paths, but it is not a categorical throughput replacement for broadcast.
If multiple concurrent consumers are required, use the
output_stream::backend::broadcast::BroadcastOutputStream.
Implementations§
Source§impl<D, R> SingleSubscriberOutputStream<D, R>
impl<D, R> SingleSubscriberOutputStream<D, R>
Sourcepub fn replay_enabled(&self) -> bool
pub fn replay_enabled(&self) -> bool
Returns whether replay-specific APIs are enabled for this stream.
Sourcepub fn replay_retention(&self) -> Option<ReplayRetention>
pub fn replay_retention(&self) -> Option<ReplayRetention>
Returns the configured replay retention.
Source§impl<D> SingleSubscriberOutputStream<D, ReplayEnabled>where
D: Delivery,
impl<D> SingleSubscriberOutputStream<D, ReplayEnabled>where
D: Delivery,
Sourcepub fn seal_replay(&self)
pub fn seal_replay(&self)
Seals replay history for future subscribers.
This is a one-way, idempotent operation.
§Panics
Panics if the internal state mutex is poisoned.
Sourcepub fn is_replay_sealed(&self) -> bool
pub fn is_replay_sealed(&self) -> bool
Returns true once replay history has been sealed.
§Panics
Panics if the internal state mutex is poisoned.
Source§impl<D, R> SingleSubscriberOutputStream<D, R>
impl<D, R> SingleSubscriberOutputStream<D, R>
Sourcepub fn wait_for_line(
&self,
timeout: Duration,
predicate: impl Fn(Cow<'_, str>) -> bool + Send + 'static,
options: LineParsingOptions,
) -> Result<impl Future<Output = Result<WaitForLineResult, StreamReadError>> + Send + 'static, StreamConsumerError>
pub fn wait_for_line( &self, timeout: Duration, predicate: impl Fn(Cow<'_, str>) -> bool + Send + 'static, options: LineParsingOptions, ) -> Result<impl Future<Output = Result<WaitForLineResult, StreamReadError>> + Send + 'static, StreamConsumerError>
Tries to wait for a line that matches the given predicate within timeout.
§Errors
Returns StreamConsumerError if the backend rejects the line waiter.
§Panics
Panics if options.max_line_length is zero.
Trait Implementations§
Source§impl<D, R> Consumable for SingleSubscriberOutputStream<D, R>
impl<D, R> Consumable for SingleSubscriberOutputStream<D, R>
Source§type Error = StreamConsumerError
type Error = StreamConsumerError
Subscribable::SubscribeError so the default consume / consume_async impls can
propagate subscription failures.Source§fn consume<V>(&self, visitor: V) -> Result<Consumer<V::Output>, Self::Error>where
V: StreamVisitor,
Self: OutputStream,
fn consume<V>(&self, visitor: V) -> Result<Consumer<V::Output>, Self::Error>where
V: StreamVisitor,
Self: OutputStream,
StreamVisitor over this stream and returns a
Consumer that owns the spawned task. Read moreSource§fn consume_async<V>(
&self,
visitor: V,
) -> Result<Consumer<V::Output>, Self::Error>where
V: AsyncStreamVisitor,
Self: OutputStream,
fn consume_async<V>(
&self,
visitor: V,
) -> Result<Consumer<V::Output>, Self::Error>where
V: AsyncStreamVisitor,
Self: OutputStream,
AsyncStreamVisitor over this stream and
returns a Consumer that owns the spawned task. Read moreSource§impl<D, R> Debug for SingleSubscriberOutputStream<D, R>
impl<D, R> Debug for SingleSubscriberOutputStream<D, R>
Source§impl<D, R> Drop for SingleSubscriberOutputStream<D, R>
impl<D, R> Drop for SingleSubscriberOutputStream<D, R>
Source§impl<D, R> OutputStream for SingleSubscriberOutputStream<D, R>
impl<D, R> OutputStream for SingleSubscriberOutputStream<D, R>
Source§fn read_chunk_size(&self) -> NumBytes
fn read_chunk_size(&self) -> NumBytes
stream_reader.Source§fn max_buffered_chunks(&self) -> usize
fn max_buffered_chunks(&self) -> usize
Source§impl<D, R> Subscribable for SingleSubscriberOutputStream<D, R>
impl<D, R> Subscribable for SingleSubscriberOutputStream<D, R>
Source§type Subscription = SingleSubscriberSubscription
type Subscription = SingleSubscriberSubscription
try_subscribe.