pub enum ServerPacket {
Welcome {
username: String,
room: String,
},
ChatMessage {
from: String,
room: String,
text: String,
},
SystemMessage {
text: String,
},
Error {
message: String,
},
Pong,
RoomJoined {
room: String,
messages: Vec<MessageRecord>,
},
RoomList {
rooms: Vec<String>,
},
}Expand description
Server-to-client protocol packets.
Variants§
Welcome
Successful handshake response.
ChatMessage
Chat message broadcast by the server.
Fields
SystemMessage
System generated message.
Error
Error reported by the server.
Pong
Heartbeat ping response.
RoomJoined
Confirms the client had successfully joined a room.
Fields
§
messages: Vec<MessageRecord>Message history..
RoomList
Response to ListRooms,
Trait Implementations§
Source§impl Clone for ServerPacket
impl Clone for ServerPacket
Source§fn clone(&self) -> ServerPacket
fn clone(&self) -> ServerPacket
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 moreSource§impl Debug for ServerPacket
impl Debug for ServerPacket
Source§impl<'de> Deserialize<'de> for ServerPacket
impl<'de> Deserialize<'de> for ServerPacket
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ServerPacket
impl PartialEq for ServerPacket
Source§impl Serialize for ServerPacket
impl Serialize for ServerPacket
impl Eq for ServerPacket
impl StructuralPartialEq for ServerPacket
Auto Trait Implementations§
impl Freeze for ServerPacket
impl RefUnwindSafe for ServerPacket
impl Send for ServerPacket
impl Sync for ServerPacket
impl Unpin for ServerPacket
impl UnsafeUnpin for ServerPacket
impl UnwindSafe for ServerPacket
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