aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-05-01 22:58:20 -0500
committermat <github@matdoes.dev>2022-05-01 22:58:20 -0500
commitdb2fcecdc38ea7a43b098c6282dd906b73981f97 (patch)
tree3a383f10c8fff52e49503f145f10add98020e6de
parent44db8948d681df4245f3d93173667b10e58e046b (diff)
downloadazalea-drasl-db2fcecdc38ea7a43b098c6282dd906b73981f97.tar.xz
Change some generics to impl Trait
-rwxr-xr-xazalea-nbt/src/decode.rs25
1 files changed, 5 insertions, 20 deletions
diff --git a/azalea-nbt/src/decode.rs b/azalea-nbt/src/decode.rs
index 52f1c97e..7f2ca754 100755
--- a/azalea-nbt/src/decode.rs
+++ b/azalea-nbt/src/decode.rs
@@ -7,10 +7,7 @@ use std::io::BufRead;
use std::io::Read;
#[inline]
-fn read_string<R>(stream: &mut R) -> Result<String, Error>
-where
- R: Read,
-{
+fn read_string(stream: &mut impl Read) -> Result<String, Error> {
let length = stream.read_u16::<BE>()?;
let mut buf = Vec::with_capacity(length as usize);
@@ -22,10 +19,7 @@ where
impl Tag {
#[inline]
- fn read_known<R>(stream: &mut R, id: u8) -> Result<Tag, Error>
- where
- R: Read,
- {
+ fn read_known(stream: &mut impl Read, id: u8) -> Result<Tag, Error> {
let tag = match id {
// Signifies the end of a TAG_Compound. It is only ever used inside
// a TAG_Compound, and is not named despite being in a TAG_Compound
@@ -116,10 +110,7 @@ impl Tag {
Ok(tag)
}
- pub fn read<R>(stream: &mut R) -> Result<Tag, Error>
- where
- R: Read,
- {
+ pub fn read(stream: &mut impl Read) -> Result<Tag, Error> {
// default to compound tag
// the parent compound only ever has one item
@@ -135,18 +126,12 @@ impl Tag {
Ok(Tag::Compound(map))
}
- pub fn read_zlib<R>(stream: &mut R) -> Result<Tag, Error>
- where
- R: BufRead,
- {
+ pub fn read_zlib(stream: &mut impl BufRead) -> Result<Tag, Error> {
let mut gz = ZlibDecoder::new(stream);
Tag::read(&mut gz)
}
- pub fn read_gzip<R>(stream: &mut R) -> Result<Tag, Error>
- where
- R: Read,
- {
+ pub fn read_gzip(stream: &mut impl Read) -> Result<Tag, Error> {
let mut gz = GzDecoder::new(stream);
Tag::read(&mut gz)
}