Trait valence::client::ClientConnection
source · pub trait ClientConnection:
Send
+ Sync
+ 'static {
// Required methods
fn try_send(&mut self, bytes: BytesMut) -> Result<(), Error>;
fn try_recv(&mut self) -> Result<Option<ReceivedPacket>, Error>;
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<(), Error>
fn try_send(&mut self, bytes: BytesMut) -> Result<(), Error>
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>, Error>
fn try_recv(&mut self) -> Result<Option<ReceivedPacket>, Error>
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
.