Trait valence_server::client::ClientConnection
source · pub trait ClientConnection:
Send
+ Sync
+ 'static {
// Required methods
fn try_send(&mut self, bytes: BytesMut) -> Result<()>;
fn try_recv(&mut self) -> Result<Option<ReceivedPacket>>;
fn len(&self) -> usize;
// Provided method
fn is_empty(&self) -> bool { ... }
}
Expand description
Represents the bidirectional packet channel between the server and a client in the “play” state.
Required Methods§
sourcefn try_send(&mut self, bytes: BytesMut) -> Result<()>
fn try_send(&mut self, bytes: BytesMut) -> Result<()>
Sends encoded clientbound packet data. This function must not block and the data should be sent as soon as possible.
sourcefn try_recv(&mut self) -> Result<Option<ReceivedPacket>>
fn try_recv(&mut self) -> Result<Option<ReceivedPacket>>
Receives the next pending serverbound packet. This must return immediately without blocking.
sourcefn len(&self) -> usize
fn len(&self) -> usize
The number of pending packets waiting to be received via
Self::try_recv
.