pub struct WorkerConnection {
pub key: WorkerConnectionKey,
pub sender: Sender<Message>,
/* private fields */
}Expand description
Models an active, authenticated worker WebSocket connection.
Fields§
§key: WorkerConnectionKeyAuthentication metadata.
sender: Sender<Message>Channel sender to push frames onto the worker’s writer loop.
Implementations§
Source§impl WorkerConnection
impl WorkerConnection
Sourcepub fn new(
key: WorkerConnectionKey,
sender: Sender<Message>,
now_ms: u64,
) -> Self
pub fn new( key: WorkerConnectionKey, sender: Sender<Message>, now_ms: u64, ) -> Self
Creates a new worker connection handle.
Sourcepub fn new_in_cluster(
key: WorkerConnectionKey,
cluster_id: ClusterId,
sender: Sender<Message>,
now_ms: u64,
) -> Self
pub fn new_in_cluster( key: WorkerConnectionKey, cluster_id: ClusterId, sender: Sender<Message>, now_ms: u64, ) -> Self
Creates a worker connection bound to an explicit cluster.
Sourcepub fn cluster_id(&self) -> Option<&ClusterId>
pub fn cluster_id(&self) -> Option<&ClusterId>
Returns the cluster bound during authenticated connection setup.
Sourcepub fn update_heartbeat(&self, now_ms: u64)
pub fn update_heartbeat(&self, now_ms: u64)
Updates the heartbeat timestamp.
Sourcepub fn last_heartbeat(&self) -> u64
pub fn last_heartbeat(&self) -> u64
Gets the last heartbeat timestamp.
Trait Implementations§
Source§impl Clone for WorkerConnection
impl Clone for WorkerConnection
Source§fn clone(&self) -> WorkerConnection
fn clone(&self) -> WorkerConnection
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for WorkerConnection
impl RefUnwindSafe for WorkerConnection
impl Send for WorkerConnection
impl Sync for WorkerConnection
impl Unpin for WorkerConnection
impl UnsafeUnpin for WorkerConnection
impl UnwindSafe for WorkerConnection
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