Struct re_smart_channel::Sender
source · pub struct Sender<T: Send> {
tx: Sender<SmartMessage<T>>,
source: Arc<SmartMessageSource>,
stats: Arc<SharedStats>,
}
Fields§
§tx: Sender<SmartMessage<T>>
§source: Arc<SmartMessageSource>
§stats: Arc<SharedStats>
Implementations§
source§impl<T: Send> Sender<T>
impl<T: Send> Sender<T>
pub(crate) fn new( tx: Sender<SmartMessage<T>>, source: Arc<SmartMessageSource>, stats: Arc<SharedStats> ) -> Self
sourcepub fn clone_as(&self, source: SmartMessageSource) -> Self
pub fn clone_as(&self, source: SmartMessageSource) -> Self
Clones the sender with an updated source.
pub fn send(&self, msg: T) -> Result<(), SendError<T>>
sourcepub fn send_at(
&self,
time: Instant,
source: Arc<SmartMessageSource>,
payload: SmartMessagePayload<T>
) -> Result<(), SendError<SmartMessagePayload<T>>>
pub fn send_at( &self, time: Instant, source: Arc<SmartMessageSource>, payload: SmartMessagePayload<T> ) -> Result<(), SendError<SmartMessagePayload<T>>>
Forwards a message as-is.
sourcepub fn flush_blocking(&self) -> Result<(), SendError<()>>
pub fn flush_blocking(&self) -> Result<(), SendError<()>>
Blocks until all previously sent messages have been received.
Note: This is only implemented for non-wasm targets since we cannot make blocking calls on web.
sourcepub fn quit(
&self,
err: Option<Box<dyn Error + Send>>
) -> Result<(), SendError<SmartMessage<T>>>
pub fn quit( &self, err: Option<Box<dyn Error + Send>> ) -> Result<(), SendError<SmartMessage<T>>>
Used to indicate that a sender has left.
This sends a message down the channel allowing the receiving end to know whether one of the sender has left, and if so why (if applicable).
Using a Sender
after calling quit
is undefined behavior: the receiving end is free
to silently drop those messages (or worse).
sourcepub fn latency_ns(&self) -> u64
pub fn latency_ns(&self) -> u64
Latest known latency from sending a message to receiving it, it nanoseconds.
sourcepub fn latency_sec(&self) -> f32
pub fn latency_sec(&self) -> f32
Latest known latency from sending a message to receiving it, in seconds
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Sender<T>
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>
Blanket Implementations§
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<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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&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<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>
Converts
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>
Converts
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