naia-lib / naia

a cross-platform (including Wasm!) networking library built in Rust. Intended to make multiplayer game development dead-simple & lightning-fast
Apache License 2.0
857 stars 61 forks source link

BitReader reading functions are not visible outside of naia #170

Closed Veritius closed 5 months ago

Veritius commented 1 year ago

The functions read_bit and read_byte in BitReader's implementation are pub(crate) preventing outside access. The Serde crate cannot be implemented outside naia due to this.

Additionally, the BitWrite trait has the write_bits function, taking a u32, but BitReader has no such parallel.

connorcarpenter commented 5 months ago

Thank you for your suggestion and looking into naia !

write_bits is actually only used for the BitCounter, I've renamed it for the next release to make that clearer.

read_bit and read_byte can be accessed from other crates by just calling:

let bit = bool::de(&mut bit_reader); and let byte = u8::de(&mut bit_reader); respectively.