diff options
| author | EightFactorial <murphkev000@gmail.com> | 2023-01-30 16:18:14 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-30 18:18:14 -0600 |
| commit | 6e818852d868eea963dd2b8489ba75b65c56fb1c (patch) | |
| tree | e786e919de7d4a1777d91e8e2fa890482970972d /azalea-protocol/src/connect.rs | |
| parent | 2539f948c7a88a86b27b1878f6c28976285f348c (diff) | |
| download | azalea-drasl-6e818852d868eea963dd2b8489ba75b65c56fb1c.tar.xz | |
More packet fixes, tests, handle error (#61)
* Fix packet, fix tests, fixedbitsets
* Clippy: Nightmare Mode
* Fix mistake
* simplify impl Display and make thing pub
---------
Co-authored-by: mat <github@matdoes.dev>
Diffstat (limited to 'azalea-protocol/src/connect.rs')
| -rwxr-xr-x | azalea-protocol/src/connect.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/azalea-protocol/src/connect.rs b/azalea-protocol/src/connect.rs index 06b306b9..cb837ba5 100755 --- a/azalea-protocol/src/connect.rs +++ b/azalea-protocol/src/connect.rs @@ -189,6 +189,7 @@ where } /// Split the reader and writer into two objects. This doesn't allocate. + #[must_use] pub fn into_split(self) -> (ReadConnection<R>, WriteConnection<W>) { (self.reader, self.writer) } @@ -229,12 +230,14 @@ impl Connection<ClientboundHandshakePacket, ServerboundHandshakePacket> { /// Change our state from handshake to login. This is the state that is used /// for logging in. + #[must_use] pub fn login(self) -> Connection<ClientboundLoginPacket, ServerboundLoginPacket> { Connection::from(self) } /// Change our state from handshake to status. This is the state that is /// used for pinging the server. + #[must_use] pub fn status(self) -> Connection<ClientboundStatusPacket, ServerboundStatusPacket> { Connection::from(self) } @@ -265,6 +268,7 @@ impl Connection<ClientboundLoginPacket, ServerboundLoginPacket> { /// Change our state from login to game. This is the state that's used when /// you're actually in the game. + #[must_use] pub fn game(self) -> Connection<ClientboundGamePacket, ServerboundGamePacket> { Connection::from(self) } @@ -343,12 +347,14 @@ impl Connection<ClientboundLoginPacket, ServerboundLoginPacket> { impl Connection<ServerboundHandshakePacket, ClientboundHandshakePacket> { /// Change our state from handshake to login. This is the state that is used /// for logging in. + #[must_use] pub fn login(self) -> Connection<ServerboundLoginPacket, ClientboundLoginPacket> { Connection::from(self) } /// Change our state from handshake to status. This is the state that is /// used for pinging the server. + #[must_use] pub fn status(self) -> Connection<ServerboundStatusPacket, ClientboundStatusPacket> { Connection::from(self) } @@ -379,6 +385,7 @@ impl Connection<ServerboundLoginPacket, ClientboundLoginPacket> { /// Change our state from login to game. This is the state that's used when /// the client is actually in the game. + #[must_use] pub fn game(self) -> Connection<ServerboundGamePacket, ClientboundGamePacket> { Connection::from(self) } @@ -406,6 +413,7 @@ where { /// Creates a `Connection` of a type from a `Connection` of another type. /// Useful for servers or custom packets. + #[must_use] pub fn from<R2, W2>(connection: Connection<R1, W1>) -> Connection<R2, W2> where R2: ProtocolPacket + Debug, |
