pub struct Relay {
pub max_rooms: usize,
/* private fields */
}Expand description
The rooms and the games connected to a relay.
Fields§
§max_rooms: usizeThe most rooms open at once; a host beyond it is refused.
Implementations§
Source§impl Relay
impl Relay
Sourcepub fn with_store(self, store: Box<dyn Store>) -> Relay
pub fn with_store(self, store: Box<dyn Store>) -> Relay
Keeps the rooms’ towns in store.
Sourcepub fn room_count(&self) -> usize
pub fn room_count(&self) -> usize
How many rooms are open.
Sourcepub fn game_count(&self) -> usize
pub fn game_count(&self) -> usize
How many games are connected.
Sourcepub fn room_of(&self, client: Client) -> Option<(String, u8)>
pub fn room_of(&self, client: Client) -> Option<(String, u8)>
The room and player number of a connected game, if it is in a room.
Sourcepub fn host_hello(&self, room: &str) -> Option<&Hello>
pub fn host_hello(&self, room: &str) -> Option<&Hello>
The Hello of a room’s host.
Sourcepub fn watch(&mut self, room: &str)
pub fn watch(&mut self, room: &str)
The server runs this room’s game: its digests are the reference from now on.
Sourcepub fn server_digest(
&mut self,
room: &str,
epoch: u32,
update: u64,
crc: u32,
) -> Vec<(Client, FromRelay)>
pub fn server_digest( &mut self, room: &str, epoch: u32, update: u64, crc: u32, ) -> Vec<(Client, FromRelay)>
The server’s own digest of a room’s game (see Relay::watch): the messages the
check gives.
Sourcepub fn take_server_saves(&mut self) -> Vec<String>
pub fn take_server_saves(&mut self) -> Vec<String>
The rooms whose server-run game is to be kept since the last call: the server sends each its save.
Auto Trait Implementations§
impl !RefUnwindSafe for Relay
impl !Sync for Relay
impl !UnwindSafe for Relay
impl Freeze for Relay
impl Send for Relay
impl Unpin for Relay
impl UnsafeUnpin for Relay
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