Struct Sender
struct Sender<T> { ... }
The sending half of a oneshot channel.
Examples
use oneshot;
use thread;
let = channel;
spawn;
assert_eq!;
Sender cannot be sent between threads if it is sending non-Send types.
#![feature(oneshot_channel)]
use std::sync::oneshot;
use std::thread;
use std::ptr;
let (sender, receiver) = oneshot::channel();
struct NotSend(*mut ());
thread::spawn(move || {
sender.send(NotSend(ptr::null_mut()));
});
let reply = receiver.try_recv().unwrap();
Implementations
impl<T> Sender<T>
fn send(self: Self, t: T) -> Result<(), SendError<T>>Attempts to send a value through this channel. This can only fail if the corresponding [
Receiver<T>] has been dropped.This method is non-blocking (wait-free).
Examples
use oneshot; use thread; let = channel; spawn; assert_eq!;
impl<T> Any for Sender<T>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Sender<T>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Sender<T>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> Debug for Sender<T>
fn fmt(self: &Self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl<T> Freeze for Sender<T>
impl<T> From for Sender<T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> RefUnwindSafe for Sender<T>
impl<T> Send for Sender<T>
impl<T> Sync for Sender<T>
impl<T> Unpin for Sender<T>
impl<T> UnwindSafe for Sender<T>
impl<T, U> Into for Sender<T>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Sender<T>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Sender<T>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>