diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2022-09-02 12:11:14 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-02 12:11:14 -0500 |
| commit | cfb190d00c70f1b09789e23f89a3c67840e0fd87 (patch) | |
| tree | 9bdc021943753d60bf437526c4c294275eae13ac /azalea-protocol/src/packets/mod.rs | |
| parent | 32458d743f757da3193717fe5554f490703640c0 (diff) | |
| download | azalea-drasl-cfb190d00c70f1b09789e23f89a3c67840e0fd87.tar.xz | |
get rid of Readable & Writable (#21)
Diffstat (limited to 'azalea-protocol/src/packets/mod.rs')
| -rw-r--r-- | azalea-protocol/src/packets/mod.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/azalea-protocol/src/packets/mod.rs b/azalea-protocol/src/packets/mod.rs index da1631a0..06647540 100644 --- a/azalea-protocol/src/packets/mod.rs +++ b/azalea-protocol/src/packets/mod.rs @@ -4,7 +4,7 @@ pub mod login; pub mod status; use crate::read::ReadPacketError; -use azalea_buf::{BufReadError, McBufWritable, Readable, Writable}; +use azalea_buf::{BufReadError, McBufVarReadable, McBufVarWritable, McBufWritable}; use std::io::{Read, Write}; pub const PROTOCOL_VERSION: u32 = 760; @@ -44,13 +44,13 @@ where impl azalea_buf::McBufReadable for ConnectionProtocol { fn read_from(buf: &mut impl Read) -> Result<Self, BufReadError> { - let id = buf.read_varint()?; + let id = i32::var_read_from(buf)?; ConnectionProtocol::from_i32(id).ok_or(BufReadError::UnexpectedEnumVariant { id }) } } impl McBufWritable for ConnectionProtocol { fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - buf.write_varint(*self as i32) + (*self as i32).var_write_into(buf) } } |
