diff options
| author | mat <github@matdoes.dev> | 2022-05-01 21:54:03 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-05-01 21:54:03 -0500 |
| commit | 567c6f4f2c39976d170111b816806453636f8241 (patch) | |
| tree | b37cc13cbd59be902fd72e43c3efb4f821f7a782 /azalea-protocol/src/packets/status | |
| parent | c2262a212328e7a9e00091d7b41a8d8bfb5b3007 (diff) | |
| download | azalea-drasl-567c6f4f2c39976d170111b816806453636f8241.tar.xz | |
Reduce usage of AsyncRead
We already receive everything from the server when it tells us the length, so we can actually just treat the stream as a Read instead of an AsyncRead.
Diffstat (limited to 'azalea-protocol/src/packets/status')
| -rwxr-xr-x | azalea-protocol/src/packets/status/clientbound_status_response_packet.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/azalea-protocol/src/packets/status/clientbound_status_response_packet.rs b/azalea-protocol/src/packets/status/clientbound_status_response_packet.rs index 884cf408..f5789ae3 100755 --- a/azalea-protocol/src/packets/status/clientbound_status_response_packet.rs +++ b/azalea-protocol/src/packets/status/clientbound_status_response_packet.rs @@ -1,3 +1,5 @@ +use std::io::Read; + use azalea_chat::component::Component; use serde::Deserialize; use serde_json::Value; @@ -43,10 +45,8 @@ impl ClientboundStatusResponsePacket { Ok(()) } - pub async fn read<T: tokio::io::AsyncRead + std::marker::Unpin + std::marker::Send>( - buf: &mut T, - ) -> Result<StatusPacket, String> { - let status_string = buf.read_utf().await?; + pub fn read(buf: &mut impl Read) -> Result<StatusPacket, String> { + let status_string = buf.read_utf()?; let status_json: Value = serde_json::from_str(status_string.as_str()).expect("Server status isn't valid JSON"); |
