pub struct TaskHandler<Ctx> { /* private fields */ }Expand description
Producer-side handle. Cheap to clone; can be shared across threads.
Implementations§
Source§impl<Ctx> TaskHandler<Ctx>
impl<Ctx> TaskHandler<Ctx>
Sourcepub fn try_send(
&self,
ch: Channel<Ctx>,
ctx: Ctx,
) -> Result<(), TrySendError<Ctx>>
pub fn try_send( &self, ch: Channel<Ctx>, ctx: Ctx, ) -> Result<(), TrySendError<Ctx>>
Non-blocking send. On a bounded channel this returns Full when the
queue is at capacity; on an unbounded channel it is effectively
infallible except when the task has already stopped.
Sourcepub fn send(&self, ch: Channel<Ctx>, ctx: Ctx) -> Result<(), TrySendError<Ctx>>
pub fn send(&self, ch: Channel<Ctx>, ctx: Ctx) -> Result<(), TrySendError<Ctx>>
Convenience wrapper over try_send that flattens
Full back into Closed-style errors. Use send_async
when you want proper backpressure on bounded channels.
For unbounded channels this is equivalent to try_send.
Sourcepub async fn send_async(
&self,
ch: Channel<Ctx>,
ctx: Ctx,
) -> Result<(), SendError<Ctx>>
pub async fn send_async( &self, ch: Channel<Ctx>, ctx: Ctx, ) -> Result<(), SendError<Ctx>>
Async send with backpressure. On bounded channels this awaits free capacity; on unbounded channels it resolves immediately.
Sourcepub fn channel_count(&self) -> usize
pub fn channel_count(&self) -> usize
Number of channels registered on this task.
Trait Implementations§
Auto Trait Implementations§
impl<Ctx> Freeze for TaskHandler<Ctx>
impl<Ctx> RefUnwindSafe for TaskHandler<Ctx>
impl<Ctx> Send for TaskHandler<Ctx>where
Ctx: Send,
impl<Ctx> Sync for TaskHandler<Ctx>where
Ctx: Send,
impl<Ctx> Unpin for TaskHandler<Ctx>
impl<Ctx> UnsafeUnpin for TaskHandler<Ctx>
impl<Ctx> UnwindSafe for TaskHandler<Ctx>
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