[−][src]Struct yaque::queue::Sender
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]
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
-
Make periodical backups. Use an external timer implementation for this.
-
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]
I: IntoIterator,
I::Item: AsRef<[u8]>,
Sends all the contents of an iterable into the queue. All is buffered to be sent atomically, in one flush operation.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Sender
[src]
impl Send for Sender
[src]
impl Sync for Sender
[src]
impl Unpin for Sender
[src]
impl UnwindSafe for Sender
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Any for T where
T: Any,
T: Any,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,