pub enum FromRelay {
Welcome {
protocol: u16,
},
Rooms(Vec<RoomInfo>),
Hosted {
room: String,
keeps: bool,
kept: Option<u64>,
},
Kept {
update: u64,
bytes: Vec<u8>,
},
Joined {
room: String,
player: u8,
},
PeerJoined {
player: u8,
},
PeerLeft {
player: u8,
},
Data {
from: u8,
data: Vec<u8>,
},
Pong(u32),
Checked {
update: u64,
agree: bool,
},
SaveWanted {
update: u64,
},
Error {
message: String,
},
}Expand description
The relay to a game.
Variants§
Welcome
The relay speaks this game’s protocol.
Rooms(Vec<RoomInfo>)
The rooms open on this relay.
Hosted
The room is open: its code (this game is player 0).
Fields
§
keeps: boolWhether the server keeps rooms’ towns: the host sends it its saves (ToRelay::Keep).
Kept
The town kept for this room.
Joined
This game joined the room as player.
PeerJoined
Another player came into the room.
PeerLeft
Another player left the room.
Data
Data from a player.
Pong(u32)
The answer to ToRelay::Ping.
Checked
The server’s check of update, to every player in the room: the games agree, or not.
SaveWanted
The players’ games differed at update, and this game is the one to keep: send the
others a save at the next update boundary.
Error
A request failed, with the reason (no such room, a wrong password, another version…).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for FromRelay
impl<'de> Deserialize<'de> for FromRelay
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
impl StructuralPartialEq for FromRelay
Auto Trait Implementations§
impl Freeze for FromRelay
impl RefUnwindSafe for FromRelay
impl Send for FromRelay
impl Sync for FromRelay
impl Unpin for FromRelay
impl UnsafeUnpin for FromRelay
impl UnwindSafe for FromRelay
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