[][src]Struct bdrck::logging::write::SyncWriteAdapter

pub struct SyncWriteAdapter<T: Write> { /* fields omitted */ }

This struct is a simple adapter which is composed of a single Write implementor. The idea is that it is guaranteed to implement Send + Sync, as well as Clone, so it allows arbitrary Write implementors to be used with LogOutputFactory.

Note that this does involve a Mutex, so in general there is a performance penalty to using this.

Methods

impl<T: Write + Send + 'static> SyncWriteAdapter<T>[src]

pub fn new(writer: T) -> Self[src]

Create a new SyncWriteAdapter which wraps the given Write implementor.

pub fn lock(&self) -> MutexGuard<T>[src]

Acquire a lock on the internal Write implementor, which allows for e.g. writing output to it without having a mutable reference to this adapter.

Trait Implementations

impl<T: Write + Send + 'static> Clone for SyncWriteAdapter<T>[src]

impl<T: Write + Send + 'static> Write for SyncWriteAdapter<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for SyncWriteAdapter<T>

impl<T> Send for SyncWriteAdapter<T> where
    T: Send

impl<T> Sync for SyncWriteAdapter<T> where
    T: Send

impl<T> Unpin for SyncWriteAdapter<T>

impl<T> UnwindSafe for SyncWriteAdapter<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<W> WriteBytesExt for W where
    W: Write + ?Sized