diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2026-01-13 10:51:45 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-13 10:51:45 -0600 |
| commit | b21ac946cafaacc9ee2478ea48ed9e72554f79ed (patch) | |
| tree | 4d05744b9801e94f5da6563d8fabddfb20d1c7b7 /azalea-core/src/bitset.rs | |
| parent | d5fa5e32b37754b3b5c136e58821e48cd3b7c2ff (diff) | |
| download | azalea-drasl-b21ac946cafaacc9ee2478ea48ed9e72554f79ed.tar.xz | |
Merge AzaleaRead and AzaleaWrite (#305)
Diffstat (limited to 'azalea-core/src/bitset.rs')
| -rw-r--r-- | azalea-core/src/bitset.rs | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/azalea-core/src/bitset.rs b/azalea-core/src/bitset.rs index 6abb5d1d..f8c9da28 100644 --- a/azalea-core/src/bitset.rs +++ b/azalea-core/src/bitset.rs @@ -3,7 +3,7 @@ use std::{ ops::Range, }; -use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite, BufReadError}; +use azalea_buf::{AzBuf, BufReadError}; /// Represents Java's BitSet, a list of bits. #[derive(AzBuf, Clone, Debug, Default, Eq, Hash, PartialEq)] @@ -176,8 +176,8 @@ impl From<Vec<u8>> for BitSet { /// /// Note that this is optimized for fast serialization and deserialization for /// Minecraft, and may not be as performant as it could be for other purposes. -/// Consider using [`FastFixedBitSet`] if you don't need the -/// `AzaleaRead`/`AzaleaWrite` implementation. +/// Consider using [`FastFixedBitSet`] if you don't need the `AzBuf` +/// implementation. #[derive(Clone, Debug, Eq, Hash, PartialEq)] pub struct FixedBitSet<const N: usize> where @@ -211,7 +211,7 @@ where } } -impl<const N: usize> AzaleaRead for FixedBitSet<N> +impl<const N: usize> AzBuf for FixedBitSet<N> where [u8; bits_to_bytes(N)]: Sized, { @@ -222,11 +222,6 @@ where } Ok(FixedBitSet { data }) } -} -impl<const N: usize> AzaleaWrite for FixedBitSet<N> -where - [u8; bits_to_bytes(N)]: Sized, -{ fn azalea_write(&self, buf: &mut impl Write) -> io::Result<()> { for i in 0..bits_to_bytes(N) { self.data[i].azalea_write(buf)?; @@ -253,7 +248,7 @@ pub const fn bits_to_bytes(n: usize) -> usize { /// use it like `FastFixedBitSet<20>` if you need 20 bits. /// /// This is almost identical to [`FixedBitSet`], but more efficient (~20% faster -/// access) and doesn't implement `AzaleaRead`/`AzaleaWrite`. +/// access) and doesn't implement `AzBuf`. #[derive(Clone, Debug, Eq, Hash, PartialEq)] pub struct FastFixedBitSet<const N: usize> where |
