Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various improvements to the protocol crate [WIP-ish] #651

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

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.

None yet

1 participant