Skip to main content

RetryWriter

Struct RetryWriter 

Source
pub struct RetryWriter<W: Writer> { /* private fields */ }
Expand description

Writer which decorates another writer in order to make it available to multiple threads. This writer is non-blocking but will try multiple times before it give up.

Implementations§

Source§

impl<W: Writer> RetryWriter<W>

Source

pub fn new(mx_writer: Arc<Mutex<W>>) -> RetryWriter<W>

Trait Implementations§

Source§

impl<W: Writer> Writer for RetryWriter<W>

Source§

fn write<E: Encodable>(&mut self, data: &E) -> Result<u32, WriteError>

Tries to acquire the inner writer than writes the given message into channel.

§Errors

Any error returned by the decorated writer will be passed on. WriteError::Wait will be returned if the inner writer cannot be acquired.

Source§

fn flush(&mut self) -> Result<(), Error>

Flushes the stream which possibly backs the kekbit writer. By default this method does nothing, and should be implemented only for Writers which it makes sense. Returns the success of the operation

Auto Trait Implementations§

§

impl<W> !RefUnwindSafe for RetryWriter<W>

§

impl<W> !UnwindSafe for RetryWriter<W>

§

impl<W> Freeze for RetryWriter<W>
where Arc<Mutex<RawMutex, W>>: Freeze,

§

impl<W> Send for RetryWriter<W>
where Arc<Mutex<RawMutex, W>>: Send,

§

impl<W> Sync for RetryWriter<W>
where Arc<Mutex<RawMutex, W>>: Sync,

§

impl<W> Unpin for RetryWriter<W>
where Arc<Mutex<RawMutex, W>>: Unpin,

§

impl<W> UnsafeUnpin for RetryWriter<W>

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, 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.