Type Alias tracing_subscriber::fmt::writer::OptionalWriter

source ·
pub type OptionalWriter<T> = EitherWriter<T, Sink>;
Expand description

A writer which may or may not be enabled.

This may be used by MakeWriter implementations that wish to conditionally enable or disable the returned writer based on a span or event’s Metadata.

Aliased Type§

enum OptionalWriter<T> {
    A(T),
    B(Sink),
}

Variants§

§

A(T)

A writer of type A.

§

B(Sink)

A writer of type B.

Implementations§

source§

impl<T> OptionalWriter<T>

source

pub fn none() -> Self

Returns a disabled writer.

Any bytes written to the returned writer are discarded.

This is equivalent to returning Option::None.

source

pub fn some(t: T) -> Self

Returns an enabled writer of type T.

This is equivalent to returning Option::Some.

Trait Implementations§

source§

impl<T> From<Option<T>> for OptionalWriter<T>

source§

fn from(opt: Option<T>) -> Self

Converts to this type from the input type.