[−][src]Struct fast_threadpool::OneshotReceiver
Implementations
impl<T> Receiver<T>[src]
pub fn try_recv(&self) -> Result<T, TryRecvError>[src]
Checks if there is a message in the channel without blocking. Returns:
Ok(message)if there was a message in the channel.Err(Empty)if theSenderis alive, but has not yet sent a message.Err(Disconnected)if theSenderwas dropped before sending anything or if the message has already been extracted by a previous receive call.
If a message is returned, the channel is disconnected and any subsequent receive operation using this receiver will return an error.
This method is completely lock-free and wait-free. The only thing it does is an atomic integer load of the channel state. And if there is a message in the channel it additionally performs one atomic integer store and copies the message from the heap to the stack for returning it.
pub fn recv(self) -> Result<T, RecvError>[src]
Attempts to wait for a message from the Sender, returning an error if the channel is
disconnected.
This method will always block the current thread if there is no data available and it is
still possible for the message to be sent. Once the message is sent to the corresponding
Sender, then this receiver will wake up and return that message.
If the corresponding Sender has disconnected (been dropped), or it disconnects while
this call is blocking, this call will wake up and return Err to indicate that the message
can never be received on this channel.
If a sent message has already been extracted from this channel this method will return an error.
Panics
Panics if called after this receiver has been polled asynchronously.
pub fn recv_ref(&self) -> Result<T, RecvError>[src]
Attempts to wait for a message from the Sender, returning an error if the channel is
disconnected. This is a non consuming version of Receiver::recv, but with a bit
worse performance. Prefer [Receiver::recv] if your code allows consuming the receiver.
If a message is returned, the channel is disconnected and any subsequent receive operation using this receiver will return an error.
Panics
Panics if called after this receiver has been polled asynchronously.
pub fn recv_timeout(&self, timeout: Duration) -> Result<T, RecvTimeoutError>[src]
Like Receiver::recv, but will not block longer than timeout. Returns:
Ok(message)if there was a message in the channel before the timeout was reached.Err(Timeout)if no message arrived on the channel before the timeout was reached.Err(Disconnected)if the sender was dropped before sending anything or if the message has already been extracted by a previous receive call.
If a message is returned, the channel is disconnected and any subsequent receive operation using this receiver will return an error.
If the supplied timeout is so large that Rust's Instant type can't represent this point
in the future this falls back to an indefinitely blocking receive operation.
Panics
Panics if called after this receiver has been polled asynchronously.
pub fn recv_deadline(&self, deadline: Instant) -> Result<T, RecvTimeoutError>[src]
Like Receiver::recv, but will not block longer than until deadline. Returns:
Ok(message)if there was a message in the channel before the deadline was reached.Err(Timeout)if no message arrived on the channel before the deadline was reached.Err(Disconnected)if the sender was dropped before sending anything or if the message has already been extracted by a previous receive call.
If a message is returned, the channel is disconnected and any subsequent receive operation using this receiver will return an error.
Panics
Panics if called after this receiver has been polled asynchronously.
Trait Implementations
impl<T> Debug for Receiver<T> where
T: Debug, [src]
T: Debug,
impl<T> Drop for Receiver<T>[src]
impl<T> Future for Receiver<T>[src]
type Output = Result<T, RecvError>
The type of value produced on completion.
pub fn poll(
self: Pin<&mut Receiver<T>>,
cx: &mut Context<'_>
) -> Poll<<Receiver<T> as Future>::Output>[src]
self: Pin<&mut Receiver<T>>,
cx: &mut Context<'_>
) -> Poll<<Receiver<T> as Future>::Output>
impl<T> Send for Receiver<T> where
T: Send, [src]
T: Send,
impl<T> Unpin for Receiver<T>[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Receiver<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> !Sync for Receiver<T>
impl<T> UnwindSafe for Receiver<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
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<F> IntoFuture for F where
F: Future, [src]
F: Future,
type Output = <F as Future>::Output
into_future)The output that the future will produce on completion.
type Future = F
into_future)Which kind of future are we turning this into?
pub fn into_future(self) -> <F as IntoFuture>::Future[src]
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<F, T, E> TryFuture for F where
F: Future<Output = Result<T, E>> + ?Sized, [src]
F: Future<Output = Result<T, E>> + ?Sized,
type Ok = T
The type of successful values yielded by this future
type Error = E
The type of failures yielded by this future
pub fn try_poll(
self: Pin<&mut F>,
cx: &mut Context<'_>
) -> Poll<<F as Future>::Output>[src]
self: Pin<&mut F>,
cx: &mut Context<'_>
) -> Poll<<F as Future>::Output>
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>,