pub enum BroadcastType<T: BroadcastTypeTrait> {
PointToPoint(T, T),
PointToGroup(T),
Unknown,
}
Expand description
Represents the type of broadcast for WebSocket messages.
This enum allows specifying whether a message is intended for a direct point-to-point communication between two entities or for a group of entities.
§Type Parameters
T
: The type used to identify points or groups, which must implementBroadcastTypeTrait
.
Variants§
PointToPoint(T, T)
Indicates a point-to-point broadcast between two specific entities.
The tuple contains the identifiers of the two entities involved in the communication.
PointToGroup(T)
Indicates a broadcast to a specific group of entities.
The tuple contains the identifier of the group.
Unknown
Represents an unknown or unhandled broadcast type.
This variant is used as a default or fallback for unhandled cases.
Implementations§
Source§impl<B: BroadcastTypeTrait> BroadcastType<B>
impl<B: BroadcastTypeTrait> BroadcastType<B>
Sourcepub fn get_key(broadcast_type: BroadcastType<B>) -> String
pub fn get_key(broadcast_type: BroadcastType<B>) -> String
Generates a unique key string for a given broadcast type.
For point-to-point types, the keys are sorted to ensure consistent key generation regardless of the order of the input keys.
§Arguments
BroadcastType<B>
- The broadcast type for which to generate the key.
§Returns
String
- The unique key string for the broadcast type.
Trait Implementations§
Source§impl<T: Clone + BroadcastTypeTrait> Clone for BroadcastType<T>
impl<T: Clone + BroadcastTypeTrait> Clone for BroadcastType<T>
Source§fn clone(&self) -> BroadcastType<T>
fn clone(&self) -> BroadcastType<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<T: Debug + BroadcastTypeTrait> Debug for BroadcastType<T>
impl<T: Debug + BroadcastTypeTrait> Debug for BroadcastType<T>
Source§impl<B: BroadcastTypeTrait> Default for BroadcastType<B>
Implements the Default
trait for BroadcastType
.
impl<B: BroadcastTypeTrait> Default for BroadcastType<B>
Implements the Default
trait for BroadcastType
.
The default value is BroadcastType::Unknown
.
§Type Parameters
B
: The type parameter forBroadcastType
, which must implementBroadcastTypeTrait
.