Struct de_multiplayer::network::Sender  
source · struct Sender(PackageSender);Tuple Fields§
§0: PackageSenderMethods from Deref<Target = Sender<OutPackage>>§
pub fn try_send(&self, msg: T) -> Result<(), TrySendError<T>>
pub fn try_send(&self, msg: T) -> Result<(), TrySendError<T>>
Attempts to send a message into the channel.
If the channel is full or closed, this method returns an error.
§Examples
use async_channel::{bounded, TrySendError};
let (s, r) = bounded(1);
assert_eq!(s.try_send(1), Ok(()));
assert_eq!(s.try_send(2), Err(TrySendError::Full(2)));
drop(r);
assert_eq!(s.try_send(3), Err(TrySendError::Closed(3)));pub fn send(&self, msg: T) -> Send<'_, T>
pub fn send(&self, msg: T) -> Send<'_, T>
Sends a message into the channel.
If the channel is full, this method waits until there is space for a message.
If the channel is closed, this method returns an error.
§Examples
use async_channel::{unbounded, SendError};
let (s, r) = unbounded();
assert_eq!(s.send(1).await, Ok(()));
drop(r);
assert_eq!(s.send(2).await, Err(SendError(2)));pub fn send_blocking(&self, msg: T) -> Result<(), SendError<T>>
pub fn send_blocking(&self, msg: T) -> Result<(), SendError<T>>
Sends a message into this channel using the blocking strategy.
If the channel is full, this method will block until there is room. If the channel is closed, this method returns an error.
§Blocking
Rather than using asynchronous waiting, like the send method,
this method will block the current thread until the message is sent.
This method should not be used in an asynchronous context. It is intended to be used such that a channel can be used in both asynchronous and synchronous contexts. Calling this method in an asynchronous context may result in deadlocks.
§Examples
use async_channel::{unbounded, SendError};
let (s, r) = unbounded();
assert_eq!(s.send_blocking(1), Ok(()));
drop(r);
assert_eq!(s.send_blocking(2), Err(SendError(2)));pub fn close(&self) -> bool
pub fn close(&self) -> bool
Closes the channel.
Returns true if this call has closed the channel and it was not closed already.
The remaining messages can still be received.
§Examples
use async_channel::{unbounded, RecvError};
let (s, r) = unbounded();
assert_eq!(s.send(1).await, Ok(()));
assert!(s.close());
assert_eq!(r.recv().await, Ok(1));
assert_eq!(r.recv().await, Err(RecvError));pub fn is_closed(&self) -> bool
pub fn is_closed(&self) -> bool
Returns true if the channel is closed.
§Examples
use async_channel::{unbounded, RecvError};
let (s, r) = unbounded::<()>();
assert!(!s.is_closed());
drop(r);
assert!(s.is_closed());pub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the channel is empty.
§Examples
use async_channel::unbounded;
let (s, r) = unbounded();
assert!(s.is_empty());
s.send(1).await;
assert!(!s.is_empty());pub fn is_full(&self) -> bool
pub fn is_full(&self) -> bool
Returns true if the channel is full.
Unbounded channels are never full.
§Examples
use async_channel::bounded;
let (s, r) = bounded(1);
assert!(!s.is_full());
s.send(1).await;
assert!(s.is_full());pub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of messages in the channel.
§Examples
use async_channel::unbounded;
let (s, r) = unbounded();
assert_eq!(s.len(), 0);
s.send(1).await;
s.send(2).await;
assert_eq!(s.len(), 2);pub fn capacity(&self) -> Option<usize>
pub fn capacity(&self) -> Option<usize>
Returns the channel capacity if it’s bounded.
§Examples
use async_channel::{bounded, unbounded};
let (s, r) = bounded::<i32>(5);
assert_eq!(s.capacity(), Some(5));
let (s, r) = unbounded::<i32>();
assert_eq!(s.capacity(), None);pub fn receiver_count(&self) -> usize
pub fn receiver_count(&self) -> usize
Returns the number of receivers for the channel.
§Examples
use async_channel::unbounded;
let (s, r) = unbounded::<()>();
assert_eq!(s.receiver_count(), 1);
let r2 = r.clone();
assert_eq!(s.receiver_count(), 2);pub fn sender_count(&self) -> usize
pub fn sender_count(&self) -> usize
Returns the number of senders for the channel.
§Examples
use async_channel::unbounded;
let (s, r) = unbounded::<()>();
assert_eq!(s.sender_count(), 1);
let s2 = s.clone();
assert_eq!(s.sender_count(), 2);pub fn downgrade(&self) -> WeakSender<T>
pub fn downgrade(&self) -> WeakSender<T>
Downgrade the sender to a weak reference.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Sender
impl RefUnwindSafe for Sender
impl Send for Sender
impl Sync for Sender
impl Unpin for Sender
impl UnwindSafe for Sender
Blanket Implementations§
§impl<T, U> AsBindGroupShaderType<U> for T
 
impl<T, U> AsBindGroupShaderType<U> for T
§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
 
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
T [ShaderType] for self. When used in [AsBindGroup]
derives, it is safe to assume that all images in self exist.source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
    T: Any,
 
impl<T> Downcast for Twhere
    T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
 
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
 
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
 
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
 
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
 
impl<T> DowncastSync for T
§impl<S> FromSample<S> for S
 
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
 
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
 
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
 
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<SS, SP> SupersetOf<SS> for SPwhere
    SS: SubsetOf<SP>,
 
impl<SS, SP> SupersetOf<SS> for SPwhere
    SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
 
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
 
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
 
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
 
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.