Skip to content

Commit ea1e9e1

Browse files
author
VictoremWinbringer
committed
change comments
1 parent 3696b47 commit ea1e9e1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ pub trait Game {
3232
/// returns bool value indicating
3333
/// should server continue running if false stops server
3434
/// called only when new commands come to server
35+
/// Commands ordered and with some guarantees.
3536
fn handle_command(
3637
&mut self,
3738
delta_time: Duration,
@@ -43,6 +44,7 @@ pub trait Game {
4344
/// returns bytes with new game state for client
4445
/// called once in about 30 milliseconds
4546
/// sends state only to clients connected to server
47+
///ordered and without some guarantees.
4648
fn draw(&mut self, delta_time: Duration) -> Vec<u8>;
4749
///allow client with this IP Address work with server
4850
/// if false server don't send new state to this client
@@ -65,6 +67,7 @@ pub trait Game {
6567
None
6668
}
6769
///Disconnect this client from server and don't send new state to them
70+
/// usually don't implement this method. Use default implementation
6871
fn remove_client(&mut self) -> Option<SocketAddr> {
6972
None
7073
}
@@ -88,14 +91,16 @@ impl ClientSocket {
8891
///Send data to server
8992
/// Don't block current thread
9093
/// may wait up to 30 milliseconds if you send commands too often
94+
///Commands ordered and with some guarantees.
9195
pub fn send(&mut self, command: Vec<u8>) -> Result<usize, Exception> {
9296
let command = self.client.send(command);
9397
self.socket.write(&command)
9498
}
9599

96100
///Reads data fro server
97101
/// Don't block current thread
98-
/// Return None if there is no data available
102+
/// Return [`Exception`] with [`io::ErrorKind::WouldBlock`] if there is no data available.
103+
///Data ordered and without some guarantees.
99104
pub fn recv(&mut self) -> Result<Vec<u8>, Exception> {
100105
let state = self.socket.read()?;
101106
let (state, lost) = self.client.recv(state)?;

0 commit comments

Comments
 (0)