aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol/src/packets/login/clientbound_game_profile_packet.rs
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2022-05-02 03:10:52 +0000
committerGitHub <noreply@github.com>2022-05-02 03:10:52 +0000
commit728f0399ff1a03f5ce8134b46e6150daf1e2076d (patch)
tree5a21ef239d8e5cabdc0b5d3d511e35dc25435041 /azalea-protocol/src/packets/login/clientbound_game_profile_packet.rs
parentc2262a212328e7a9e00091d7b41a8d8bfb5b3007 (diff)
parente1b6bc965a3f71d64b4dc3075da21c578ab5b508 (diff)
downloadazalea-drasl-728f0399ff1a03f5ce8134b46e6150daf1e2076d.tar.xz
Merge pull request #4 from mat-1/sync-decoding
Reduce usage of AsyncRead
Diffstat (limited to 'azalea-protocol/src/packets/login/clientbound_game_profile_packet.rs')
-rwxr-xr-xazalea-protocol/src/packets/login/clientbound_game_profile_packet.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/azalea-protocol/src/packets/login/clientbound_game_profile_packet.rs b/azalea-protocol/src/packets/login/clientbound_game_profile_packet.rs
index ccf0f482..bcdcd105 100755
--- a/azalea-protocol/src/packets/login/clientbound_game_profile_packet.rs
+++ b/azalea-protocol/src/packets/login/clientbound_game_profile_packet.rs
@@ -1,3 +1,5 @@
+use std::io::Read;
+
use super::LoginPacket;
use crate::mc_buf::{Readable, Writable};
use azalea_auth::game_profile::GameProfile;
@@ -23,17 +25,15 @@ impl ClientboundGameProfilePacket {
Ok(())
}
- pub async fn read<T: tokio::io::AsyncRead + std::marker::Unpin + std::marker::Send>(
- buf: &mut T,
- ) -> Result<LoginPacket, String> {
+ pub fn read(buf: &mut impl Read) -> Result<LoginPacket, String> {
// TODO: we have a thing to read from the uuid now
let uuid = Uuid::from_int_array([
- buf.read_int().await? as u32,
- buf.read_int().await? as u32,
- buf.read_int().await? as u32,
- buf.read_int().await? as u32,
+ buf.read_int()? as u32,
+ buf.read_int()? as u32,
+ buf.read_int()? as u32,
+ buf.read_int()? as u32,
]);
- let name = buf.read_utf_with_len(16).await?;
+ let name = buf.read_utf_with_len(16)?;
Ok(ClientboundGameProfilePacket {
game_profile: GameProfile::new(uuid, name),
}