Struct Sender
pub struct Sender<T> { pub(in ::sync::oneshot) inner: 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();
Fields
inner: Sender<T>The
oneshotchannel is simply a wrapper around ampmcchannel.
Implementations
impl<T> Sender<T>
fn send(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!;
Trait Implementations
impl<T> Debug for Sender<T>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<T> Sync for Sender<T>
Auto Trait Implementations
impl<T> Freeze for Sender<T>
where
Sender<T>: Freeze,
impl<T> RefUnwindSafe for Sender<T>
where
Sender<T>: RefUnwindSafe,
impl<T> Send for Sender<T>
where
Sender<T>: Send,
impl<T> Unpin for Sender<T>
where
Sender<T>: Unpin,
impl<T> UnsafeUnpin for Sender<T>
where
Sender<T>: UnsafeUnpin,
impl<T> UnwindSafe for Sender<T>
where
Sender<T>: UnwindSafe,
Blanket Implementations
impl<T> Any for Sender<T>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Sender<T>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Sender<T>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for Sender<T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for Sender<T>
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for Sender<T>
impl<T, U> Into<U> for Sender<T>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Sender<T>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Sender<T>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>