[][src]Struct secc::SeccReceiver

pub struct SeccReceiver<T: Sync + Send + Clone> { /* fields omitted */ }

Receiver side of the channel.

Methods

impl<T: Sync + Send + Clone> SeccReceiver<T>[src]

pub fn peek(&self) -> Result<T, SeccErrors<T>>[src]

Peeks at the next receivable message in the channel and returns a Clone of the message. Note that the message isn't guaranteed to stay in the channel as a thread could pop the message off while another thread is looking at the value but the value shouldn't change under the peeking thread.

pub fn receive(&self) -> Result<T, SeccErrors<T>>[src]

Receives the next message that is receivable. This will either receive the message at the head of the channel or, in the case that there is a skip cursor active, the next receivable message will be in the node pointed to by the skip cursor. This means that it is possible that receive could return an SeccErrors::Empty when there are actually messages in the channel because there will be none readable until the skip is reset.

pub fn pop(&self) -> Result<(), SeccErrors<T>>[src]

Removes the next receivable message in the channel and abandons it or returns an error if the channel was empty.

pub fn receive_await_timeout(
    &self,
    timeout: Duration
) -> Result<T, SeccErrors<T>>
[src]

A helper to call SeccReceiver::receive and await receivable messages until a message is aailable or the specified timeout has expired.

pub fn receive_await(&self) -> Result<T, SeccErrors<T>>[src]

pub fn skip(&self) -> Result<(), SeccErrors<T>>[src]

Skips the next message to be received from the channel. If the skip succeeds than the number of receivable messages will drop by one. Calling this function will either set up a skip cursor in the channel or move an existing skip cursor. To receive skipped messages the user will need to clear the skip cursor by calling the function reset_skip prior to calling receive.

pub fn reset_skip(&self) -> Result<(), SeccErrors<T>>[src]

Cancels skipping messages in the channel and resets the skipped and cursor pointers to NIL allowing previously skipped messages to be received. Note that calling this method on a channel with no skip cursor will do nothing.

pub fn receive_and_reset_skip(&self) -> Result<T, SeccErrors<T>>[src]

Receive the message at the current cursor and then resets the skip cursor. If there is currently no skip cursor this is the same as calling [receive].

pub fn pop_and_reset_skip(&self) -> Result<(), SeccErrors<T>>[src]

Pops the message at the current cursor and then resets the skip cursor. If there is currently no skip cursor this is the same as calling [pop].

Trait Implementations

impl<T: Sync + Send + Clone> SeccCoreOps<T> for SeccReceiver<T>[src]

impl<T: Sync + Send + Clone> Clone for SeccReceiver<T>[src]

impl<T: Send + Sync + Clone> Send for SeccReceiver<T>[src]

impl<T: Send + Sync + Clone> Sync for SeccReceiver<T>[src]

impl<T: Sync + Send + Clone> Debug for SeccReceiver<T>[src]

This function will write a debug string for the SeccReceiver but be warned that it will acquire the mutex lock to the receive_ptrs to accomplish this so a deadlock could ensue if you have two threads asking for debug on both SeccSender and SeccReceiver, especially if they are doing so in a different order.

Auto Trait Implementations

impl<T> Unpin for SeccReceiver<T>

impl<T> !UnwindSafe for SeccReceiver<T>

impl<T> !RefUnwindSafe for SeccReceiver<T>

Blanket Implementations

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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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