Struct crystalorb_mock_network::MockNetwork [−][src]
pub struct MockNetwork {
pub connections: HashMap<ConnectionHandleType, MockConnection>,
}
Fields
connections: HashMap<ConnectionHandleType, MockConnection>
Implementations
Trait Implementations
Returns the “default value” for a type. Read more
type ConnectionType = MockConnectionRef<'a>
type ConnectionType = MockConnectionRef<'a>
The Connection
structure that CrystalOrb will use to send/receive messages from a
specific remote machine. This may probably be a wrapper to a mutable reference to some
connection type that is used by your external networking library of choice, in which
case a generic lifetime parameter is provided here that you can use. Read more
Get a specific connection given its connection handle.
fn connections<'a>(
&'a mut self
) -> Box<dyn Iterator<Item = (ConnectionHandleType, Self::ConnectionType)> + 'a>
fn connections<'a>(
&'a mut self
) -> Box<dyn Iterator<Item = (ConnectionHandleType, Self::ConnectionType)> + 'a>
Iterate through the available connections. For servers, this would be the list of current client connections that are still alive. For the client, this would only contain the connection to the server once the connection has been established. Read more
fn broadcast_message<MessageType>(&mut self, message: MessageType) where
MessageType: 'static + Debug + Clone + Serialize + DeserializeOwned + Send + Sync,
fn broadcast_message<MessageType>(&mut self, message: MessageType) where
MessageType: 'static + Debug + Clone + Serialize + DeserializeOwned + Send + Sync,
Optional: Send the given message to all active connections. A default implementation is
already given that uses NetworkResource::connections
and Connection::send
. Read more
Optional: Send the given message to the given connection. A default implementation is
already given that uses NetworkResource::get_connection
and Connection::send
. Read more
Auto Trait Implementations
impl !RefUnwindSafe for MockNetwork
impl !Send for MockNetwork
impl !Sync for MockNetwork
impl Unpin for MockNetwork
impl !UnwindSafe for MockNetwork
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more