pub struct Sender<T: Send + 'static> {
inner: *mut ChannelInner<T>,
}Expand description
Fields§
§inner: *mut ChannelInner<T>Implementations§
Source§impl<T: Send + 'static> Sender<T>
impl<T: Send + 'static> Sender<T>
fn inner<'a>(&self) -> &'a ChannelInner<T>
Sourcepub fn has_receiver(&self) -> bool
pub fn has_receiver(&self) -> bool
Does anyone can receive a value through this channel.
Sourcepub fn send(&self, t: T) -> Result<(), SendError<T>>
pub fn send(&self, t: T) -> Result<(), SendError<T>>
Sends a value on this channel.
This function will block until space in the internal buffer becomes available or a receiver is available to hand off the message to.
Note that a successful send does not guarantee that the receiver will ever see the data if there is a buffer on this channel. Items may be enqueued in the internal buffer for the receiver to receive at a later time. If the buffer size is 0, however, the channel becomes a rendezvous channel and it guarantees that the receiver has indeed received the data if this function returns success.
This function will never panic, but it may return Err if the
Receiver has disconnected and is no longer able to receive
information.
Sourcepub fn try_send(&self, t: T) -> Result<(), TrySendError<T>>
pub fn try_send(&self, t: T) -> Result<(), TrySendError<T>>
Attempts to send a value on this channel without blocking.
This method differs from send by returning immediately if the
channel’s buffer is full or no receiver is waiting to acquire some
data. Compared with send, this function has two failure cases
instead of one (one for disconnection, one for a full buffer).
See send for notes about guarantees of whether the
receiver has received the data or not if this function is successful.
Trait Implementations§
impl<T: Send> Send for Sender<T>
impl<T: Send> Sync for Sender<T>
Auto Trait Implementations§
impl<T> Freeze for Sender<T>
impl<T> !RefUnwindSafe for Sender<T>
impl<T> Unpin for Sender<T>
impl<T> !UnwindSafe for Sender<T>
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)