Trait crystalorb::network_resource::Connection [−][src]
pub trait Connection<WorldType: World> {
fn recv_command(&mut self) -> Option<Timestamped<WorldType::CommandType>>;
fn recv_snapshot(&mut self) -> Option<Timestamped<WorldType::SnapshotType>>;
fn recv_clock_sync(&mut self) -> Option<ClockSyncMessage>;
fn send<MessageType>(&mut self, message: MessageType) -> Option<MessageType>
where
MessageType: Debug + Clone + Serialize + DeserializeOwned + Send + Sync + 'static;
fn flush<MessageType>(&mut self)
where
MessageType: Debug + Clone + Serialize + DeserializeOwned + Send + Sync + 'static;
}
Expand description
Representation of a connection to a specific remote machine that allows CrystalOrb to send and receive messages.
Required methods
fn recv_command(&mut self) -> Option<Timestamped<WorldType::CommandType>>
fn recv_command(&mut self) -> Option<Timestamped<WorldType::CommandType>>
Interface for CrystalOrb to receive the next command message.
fn recv_snapshot(&mut self) -> Option<Timestamped<WorldType::SnapshotType>>
fn recv_snapshot(&mut self) -> Option<Timestamped<WorldType::SnapshotType>>
Interface for CrystalOrb to receive the next snapshot message.
fn recv_clock_sync(&mut self) -> Option<ClockSyncMessage>
fn recv_clock_sync(&mut self) -> Option<ClockSyncMessage>
Interface for CrystalOrb to receive the next clock sync message.
Interface for CrystalOrb to try sending a message to the connection’s destination. If
unsuccessful, the message should be returned. Otherwise, None
should be returned.
CrystalOrb will invoke this method with the three message types as specified in
NetworkResource
.
Interface that CrystalOrb would use to ensure that any pending messages are sent.
CrystalOrb will invoke this method with the three message types as specified in
NetworkResource
.