pub struct WorkerChannel<T> { /* private fields */ }Expand description
Bidirectional channel for worker communication
Implementations§
Source§impl<T: Clone> WorkerChannel<T>
impl<T: Clone> WorkerChannel<T>
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create with specific capacity
Sourcepub fn split(&self) -> (WorkerSender<T>, WorkerReceiver<T>)
pub fn split(&self) -> (WorkerSender<T>, WorkerReceiver<T>)
Create a sender/receiver pair
Sourcepub fn send(&self, msg: WorkerMessage<T>) -> bool
pub fn send(&self, msg: WorkerMessage<T>) -> bool
Send message from worker side
Sourcepub fn recv(&self) -> Option<WorkerMessage<T>>
pub fn recv(&self) -> Option<WorkerMessage<T>>
Receive message on UI side
Sourcepub fn send_command(&self, cmd: WorkerCommand) -> bool
pub fn send_command(&self, cmd: WorkerCommand) -> bool
Send command from UI to worker
Sourcepub fn recv_command(&self) -> Option<WorkerCommand>
pub fn recv_command(&self) -> Option<WorkerCommand>
Receive command on worker side
Sourcepub fn has_messages(&self) -> bool
pub fn has_messages(&self) -> bool
Check if there are pending messages for UI (lock-free)
Sourcepub fn has_commands(&self) -> bool
pub fn has_commands(&self) -> bool
Check if there are pending commands for worker (lock-free)
Sourcepub fn message_count(&self) -> usize
pub fn message_count(&self) -> usize
Get number of pending messages (lock-free)
Trait Implementations§
Source§impl<T: Clone> Clone for WorkerChannel<T>
impl<T: Clone> Clone for WorkerChannel<T>
Auto Trait Implementations§
impl<T> Freeze for WorkerChannel<T>
impl<T> RefUnwindSafe for WorkerChannel<T>
impl<T> Send for WorkerChannel<T>where
T: Send,
impl<T> Sync for WorkerChannel<T>where
T: Send,
impl<T> Unpin for WorkerChannel<T>
impl<T> UnsafeUnpin for WorkerChannel<T>
impl<T> UnwindSafe for WorkerChannel<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