--- a/rust/hedgewars-server/src/handlers/actions.rs Sat Jan 11 05:15:01 2020 +0100
+++ b/rust/hedgewars-server/src/handlers/actions.rs Tue Jan 14 01:30:03 2020 +0300
@@ -12,6 +12,7 @@
use rand::{distributions::Uniform, thread_rng, Rng};
use std::{io, io::Write, iter::once, mem::replace};
+#[derive(Clone)]
pub enum DestinationGroup {
All,
Lobby,
@@ -19,6 +20,7 @@
Protocol(u16),
}
+#[derive(Clone)]
pub enum Destination {
ToId(ClientId),
ToIds(Vec<ClientId>),
@@ -112,4 +114,10 @@
pub fn send_all(self) -> PendingMessage {
PendingMessage::send_all(self)
}
+ pub fn send_to_destination(self, destination: Destination) -> PendingMessage {
+ PendingMessage {
+ destination,
+ message: self,
+ }
+ }
}