pub struct ProducerHandle<D: Clone> { /* private fields */ }Expand description
Cloneable handle that lets user-facing services enqueue tasks without touching the queue directly. Internally this just forwards to the dispatcher over a bounded channel.
Implementations§
Source§impl<D> ProducerHandle<D>
impl<D> ProducerHandle<D>
pub fn new(tx: Sender<ProducerMsg<D>>) -> Self
Sourcepub fn channel(buffer: usize) -> (ProducerHandle<D>, Receiver<ProducerMsg<D>>)
pub fn channel(buffer: usize) -> (ProducerHandle<D>, Receiver<ProducerMsg<D>>)
Convenience to build a bounded producer channel and the receiving side.
pub async fn enqueue(&self, task: Task<D>) -> Result<(), ProducerError>
pub fn sender(&self) -> Sender<ProducerMsg<D>>
Trait Implementations§
Auto Trait Implementations§
impl<D> Freeze for ProducerHandle<D>
impl<D> RefUnwindSafe for ProducerHandle<D>
impl<D> Send for ProducerHandle<D>
impl<D> Sync for ProducerHandle<D>
impl<D> Unpin for ProducerHandle<D>
impl<D> UnsafeUnpin for ProducerHandle<D>
impl<D> UnwindSafe for ProducerHandle<D>
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