azalea-rs / azalea

A collection of Rust crates for making Minecraft bots, clients, and tools.
https://azalea.matdoes.dev
MIT License
371 stars 47 forks source link

Replace impl Read with Cursor<&[u8]> #26

Closed mat-1 closed 1 year ago

mat-1 commented 1 year ago

Replacing the generic impl Read with Cursor<&[u8]> lets us view directly inside of the buffer, allowing us to do neat things like making sure the other connection isn't lying to us about how many bytes we have to read, and potentially making some things non-allocating in the future.

The branch is called "no cursor" because my (flawed) initial approach didn't use Cursor.