Skip to content

Conversation

BGR360
Copy link
Contributor

@BGR360 BGR360 commented Jan 18, 2022

I don't necessarily expect this to be merged, but I thought I would more publicly show the changes that I have made on my local fork of stevenarealla.

I am attempting to use the protocol crate to develop my own minecraft client using Bevy (mostly as a learning exercise / something to keep me busy, for now).

These changes represent ease-of-use improvements that I think would be generally desirable for the project. Please let me know what you think!

Note: the first two commits are already present in my two other PRs, they're here because I rebased this branch off of them and I'm not git-savvy enough to figure out how to not have them there.

This is really useful for anyone who wishes to use the steven_protocol
crate and write tests that compare packets to expected values.
For users of the crate, it's important to be able to set this if
they are not going through the `Conn` class.

Ideally, the protocol version would be plumbed through every
`Serializable` impl, but that's a much bigger refactor.
Previously, the Packet enum was a whopping 4,264 bytes in size (over a page!).
Not only is this just bad for performance (lots of memmoving), but I think it was
also causing weird stack overflow segfaults on my machine.
Currently, the `hyper` crate (dependency of `reqwest`) causes linker errors when
you attempt to compile a consumer of `steven_protocol` as a dylib. Compiling as
a dylib is not uncommon for quick iteration; notably popularized by the Bevy
game engine.

See rust-lang/rust#82151 (comment).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant