pub struct Listener<T> { /* private fields */ }Available on crate feature
client only.Expand description
A listener for broadcasts of type T.
Constructed through Handle::on_broadcast. Dropping this removes the
listener.
Implementations§
Source§impl<T> Listener<T>
impl<T> Listener<T>
Sourcepub async fn recv_raw(&mut self) -> Option<Result<RawPacket, Error>>
pub async fn recv_raw(&mut self) -> Option<Result<RawPacket, Error>>
Receive the next raw broadcast.
Returns None if the service has been shut down.
Sourcepub async fn recv(&mut self) -> Option<Result<Packet<T>, Error>>
pub async fn recv(&mut self) -> Option<Result<Packet<T>, Error>>
Receive the next broadcast.
Returns None if the service has been shut down.
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clear the listener without dropping it.
This removes the associated listener from being notified. Any broadcasts
which have already been buffered can still be received, after which
Listener::recv returns None.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Listener<T>
impl<T> RefUnwindSafe for Listener<T>where
T: RefUnwindSafe,
impl<T> Send for Listener<T>where
T: Send,
impl<T> Sync for Listener<T>where
T: Sync,
impl<T> Unpin for Listener<T>where
T: Unpin,
impl<T> UnsafeUnpin for Listener<T>
impl<T> UnwindSafe for Listener<T>where
T: UnwindSafe,
Blanket Implementations§
impl<Token, Builder, How> AllPropsFor<Builder, How> for Tokenwhere
Builder: Buildable<Token>,
<Builder as Buildable<Token>>::WrappedToken: HasAllProps<<Builder as Buildable<Token>>::Output, How>,
impl<Token, Builder, How> AllPropsFor<Builder, How> for Tokenwhere
Builder: Buildable<Token>,
<Builder as Buildable<Token>>::WrappedToken: HasAllProps<<Builder as Buildable<Token>>::Output, How>,
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> HasAllProps<(), T> for T
impl<T> HasAllProps<(), T> for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
Source§fn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
Convert
self to a value of a Properties struct.Source§impl<T> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
Source§fn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
Convert
self to a value of a Properties struct.Source§impl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
Source§fn into_prop_value(self) -> T
fn into_prop_value(self) -> T
Convert
self to a value of a Properties struct.Source§impl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
Source§fn into_prop_value(self) -> T
fn into_prop_value(self) -> T
Convert
self to a value of a Properties struct.