Use send_fallible in notify_client implementation to document that any errors are ignored (and use if let instead of map)

This commit is contained in:
Imbris 2022-08-20 17:21:46 -04:00
parent f1b6805c65
commit 87815b4615
2 changed files with 5 additions and 3 deletions

View File

@ -140,6 +140,7 @@ impl Client {
}*/
}
/// Like `send` but any errors are explicitly ignored.
pub(crate) fn send_fallible<M: Into<ServerMsg>>(&self, msg: M) { let _ = self.send(msg); }
pub(crate) fn send_prepared(&self, msg: &PreparedMsg) -> Result<(), StreamError> {

View File

@ -1172,11 +1172,12 @@ impl Server {
where
S: Into<ServerMsg>,
{
self.state
if let Some(client) = self.state
.ecs()
.read_storage::<Client>()
.get(entity)
.map(|c| c.send(msg));
.get(entity) {
client.send_fallible(msg);
}
}
pub fn notify_players(&mut self, msg: ServerGeneral) { self.state.notify_players(msg); }