pub enum ClientEvent {
Connected {
info: ConnectionInfo,
},
Disconnected {
reason: CloseReason,
},
MessageReceived(TransportContext),
MessageSent {
message_id: u32,
},
Error {
error: TransportError,
},
}Expand description
[SIMPLE] User-friendly client events - completely hide Packet complexity
Variants§
Connected
Connection established
Fields
§
info: ConnectionInfoDisconnected
Connection disconnected
Fields
§
reason: CloseReasonMessageReceived(TransportContext)
[SIMPLE] Message received (unified context, contains all information)
MessageSent
Message send confirmation
Error
Transport error
Fields
§
error: TransportErrorImplementations§
Source§impl ClientEvent
impl ClientEvent
Sourcepub fn from_transport_event(event: TransportEvent) -> Option<Self>
pub fn from_transport_event(event: TransportEvent) -> Option<Self>
Convert TransportEvent to ClientEvent, hiding session ID
Sourcepub fn is_connection_event(&self) -> bool
pub fn is_connection_event(&self) -> bool
Check if it’s a connection related event
Sourcepub fn is_data_event(&self) -> bool
pub fn is_data_event(&self) -> bool
Check if it’s a data transmission event
Sourcepub fn is_error_event(&self) -> bool
pub fn is_error_event(&self) -> bool
Check if it’s an error event
Trait Implementations§
Source§impl Clone for ClientEvent
impl Clone for ClientEvent
Source§fn clone(&self) -> ClientEvent
fn clone(&self) -> ClientEvent
Returns a duplicate of the value. Read more
1.0.0 · 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 ClientEvent
impl !RefUnwindSafe for ClientEvent
impl Send for ClientEvent
impl Sync for ClientEvent
impl Unpin for ClientEvent
impl UnsafeUnpin for ClientEvent
impl !UnwindSafe for ClientEvent
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