Struct Async

Source
pub struct Async { /* private fields */ }
Expand description

Async drain

Async will send all the logging records to a wrapped drain running in another thread.

Note: Dropping Async waits for it’s worker-thread to finish (thus handle all previous requests). If you can’t tolerate the delay, make sure you drop Async drain instance eg. in another thread.

Implementations§

Source§

impl Async

Source

pub fn new<D: Drain<Error = Never> + Send + 'static>(drain: D) -> Self

Create Async drain

The wrapped drain must handle all error conditions (Drain<Error=Never>). See slog::DrainExt::fuse() and slog::DrainExt::ignore_err() for typical error handling strategies.

Trait Implementations§

Source§

impl Drain for Async

Source§

type Error = Error

Type of potential errors returned during logging
Source§

fn log( &self, record: &Record<'_>, logger_values: &OwnedKeyValueList, ) -> Result<()>

Log one logging record Read more
Source§

impl Drop for Async

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl !Freeze for Async

§

impl RefUnwindSafe for Async

§

impl Send for Async

§

impl Sync for Async

§

impl Unpin for Async

§

impl UnwindSafe for Async

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<D> DrainExt for D
where D: Drain,

Source§

fn map_err<F, E>(self, f: F) -> MapError<Self, E>
where F: 'static + Sync + Send + Fn(Self::Error) -> E,

Map logging errors returned by this drain Read more
Source§

fn ignore_err(self) -> IgnoreErr<Self>

Make Self ignore and not report any error
Source§

fn fuse(self) -> Fuse<Self>
where Self::Error: Display,

Make Self panic when returning any errors
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.