Skip to main content

SingleSubscriberOutputStream

Struct SingleSubscriberOutputStream 

Source
pub struct SingleSubscriberOutputStream<D = LossyWithoutBackpressure, R = NoReplay>
where D: Delivery, R: Replay,
{ /* 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>
where D: Delivery, R: Replay,

Source

pub fn replay_enabled(&self) -> bool

Returns whether replay-specific APIs are enabled for this stream.

Source

pub fn replay_retention(&self) -> Option<ReplayRetention>

Returns the configured replay retention.

Source§

impl<D> SingleSubscriberOutputStream<D, ReplayEnabled>
where D: Delivery,

Source

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.

Source

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>
where D: Delivery, R: Replay,

Source

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>
where D: Delivery, R: Replay,

Source§

type Error = StreamConsumerError

Error returned when consumer creation fails. Must be constructible from the underlying 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,

Tries to drive the provided synchronous StreamVisitor over this stream and returns a Consumer that owns the spawned task. Read more
Source§

fn consume_async<V>( &self, visitor: V, ) -> Result<Consumer<V::Output>, Self::Error>

Tries to drive the provided asynchronous AsyncStreamVisitor over this stream and returns a Consumer that owns the spawned task. Read more
Source§

impl<D, R> Debug for SingleSubscriberOutputStream<D, R>
where D: Delivery + Debug, R: Replay + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<D, R> Drop for SingleSubscriberOutputStream<D, R>
where D: Delivery, R: Replay,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<D, R> OutputStream for SingleSubscriberOutputStream<D, R>
where D: Delivery, R: Replay,

Source§

fn read_chunk_size(&self) -> NumBytes

The maximum size of every chunk read by the backing stream_reader.
Source§

fn max_buffered_chunks(&self) -> usize

The number of chunks held by the underlying async channel.
Source§

fn name(&self) -> &'static str

Type of stream. Can be “stdout” or “stderr”. But we do not guarantee this output. It should only be used for logging/debugging.
Source§

impl<D, R> Subscribable for SingleSubscriberOutputStream<D, R>
where D: Delivery, R: Replay,

Source§

type Subscription = SingleSubscriberSubscription

The concrete subscription handle returned by try_subscribe.
Source§

type SubscribeError = StreamConsumerError

The error returned when subscription fails.
Source§

fn try_subscribe(&self) -> Result<Self::Subscription, Self::SubscribeError>

Creates a new subscription for a consumer, or returns why the consumer cannot be started. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> Sink for T
where T: Send + 'static,