Struct yaque::queue::Sender[][src]

pub struct Sender { /* fields omitted */ }

The sender part of the queue. This part is lock-free and therefore can be used outside an asynchronous context.

Implementations

impl Sender[src]

pub fn open<P: AsRef<Path>>(base: P) -> Result<Sender>[src]

Opens a queue on a folder indicated by the base path for sending. The folder will be created if it does not already exist.

Errors

This function will return an IO error if the queue is already in use for sending, which is indicated by a lock file. Also, any other IO error encountered while opening will be sent.

pub fn save(&mut self) -> Result<()>[src]

👎 Deprecated since 0.5.0:

the sender state is always inferred. There is no need to save anything

Saves the sender queue state. You do not need to use method in most circumstances, since it is automatically done on drop (yes, it will be called eve if your thread panics). However, you can use this function to

  1. Make periodical backups. Use an external timer implementation for this.

  2. Handle possible IO errors in sending. The drop implementation will ignore (but log) any io errors, which may lead to data loss in an unreliable filesystem. It was implmemented this way because no errors are allowed to propagate on drop and panicking will abort the program if drop is called during a panic.

pub fn send<D: AsRef<[u8]>>(&mut self, data: D) -> Result<()>[src]

Sends some data into the queue. One send is always atomic.

Errors

This function returns any underlying errors encountered while writing or flushing the queue.

pub fn send_batch<I>(&mut self, it: I) -> Result<()> where
    I: IntoIterator,
    I::Item: AsRef<[u8]>, 
[src]

Sends all the contents of an iterable into the queue. All is buffered to be sent atomically, in one flush operation.

Errors

This function returns any underlying errors encountered while writing or flushing the queue.

Auto Trait Implementations

impl RefUnwindSafe for Sender

impl Send for Sender

impl Sync for Sender

impl Unpin for Sender

impl UnwindSafe for Sender

Blanket Implementations

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

impl<T> Any for T where
    T: Any

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> Pointable for T

type Init = T

The type for initializers.

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