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: ConnectionInfo
Disconnected
Connection disconnected
Fields
§
reason: CloseReason
MessageReceived(TransportContext)
[SIMPLE] Message received (unified context, contains all information)
MessageSent
Message send confirmation
Error
Transport error
Fields
§
error: TransportError
Implementations§
Source§impl ClientEvent
impl ClientEvent
Sourcepub fn from_transport_event(event: TransportEvent) -> Option<Self>
pub fn from_transport_event(event: TransportEvent) -> Option<Self>
从TransportEvent转换为ClientEvent,隐藏会话ID
Sourcepub fn is_connection_event(&self) -> bool
pub fn is_connection_event(&self) -> bool
判断是否为连接相关事件
Sourcepub fn is_data_event(&self) -> bool
pub fn is_data_event(&self) -> bool
判断是否为数据传输事件
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§const fn clone_from(&mut self, source: &Self)
const 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 !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