pub enum ConnectionEvent {
HandshakeCompleted {
connection_id: ConnectionId,
owner: ConnectionOwner,
peer_info: PeerInfo,
},
ConnectionFailed {
connection_id: ConnectionId,
owner: ConnectionOwner,
error: String,
},
StateChanged {
connection_id: ConnectionId,
owner: ConnectionOwner,
new_state: ConnectionInfo,
},
}Expand description
Events related to connection lifecycle and handshake process.
These events are emitted during connection establishment, handshake completion, and connection failures. They allow applications to track the state of network connections and respond to connectivity changes.
Each event includes a ConnectionOwner that identifies the dialer
or listener that owns the connection.
Variants§
HandshakeCompleted
Handshake completed successfully with a peer.
This event is emitted when the connection handshake process finishes successfully and the connection transitions to the established state. After this event, the connection is ready for document synchronization.
ConnectionFailed
Connection failed or was disconnected.
This event is emitted when a connection fails or when a connection is explicitly disconnected. This can happen due to network errors, protocol violations, or explicit disconnection.
StateChanged
This event is emitted whenever some part of the connection state changes
Implementations§
Source§impl ConnectionEvent
impl ConnectionEvent
Sourcepub fn connection_id(&self) -> ConnectionId
pub fn connection_id(&self) -> ConnectionId
Get the connection ID associated with this event.
Sourcepub fn owner(&self) -> ConnectionOwner
pub fn owner(&self) -> ConnectionOwner
Get the owner of the connection associated with this event.
Trait Implementations§
Source§impl Clone for ConnectionEvent
impl Clone for ConnectionEvent
Source§fn clone(&self) -> ConnectionEvent
fn clone(&self) -> ConnectionEvent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConnectionEvent
impl Debug for ConnectionEvent
Source§impl PartialEq for ConnectionEvent
impl PartialEq for ConnectionEvent
impl Eq for ConnectionEvent
impl StructuralPartialEq for ConnectionEvent
Auto Trait Implementations§
impl Freeze for ConnectionEvent
impl RefUnwindSafe for ConnectionEvent
impl Send for ConnectionEvent
impl Sync for ConnectionEvent
impl Unpin for ConnectionEvent
impl UnsafeUnpin for ConnectionEvent
impl UnwindSafe for ConnectionEvent
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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>
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