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

Enhance auto_encode to take number of struct fields #4297

Closed
wants to merge 1 commit into from
Closed

Enhance auto_encode to take number of struct fields #4297

wants to merge 1 commit into from

Conversation

mneumann
Copy link
Contributor

emit_struct and read_struct takes an additional len:uint parameter which tells
us how many fields the struct we are working on has.

This is required to implement an Encoder for the msgpack 1 serialization
format. To serialize a struct with msgpack you have to use arrays and the size
of the array has to be know before each of the elements are written out. JSON
as an example doesn't have this problem as it uses '[' and ']' delimiters for
arrays.

emit_struct and read_struct takes an additional len:uint parameter which tells
us how many fields the struct we are working on has.

This is required to implement an Encoder for the msgpack [1] serialization
format. To serialize a struct with msgpack you have to use arrays and the size
of the array has to be know before each of the elements are written out. JSON
as an example doesn't have this problem as it uses '[' and ']' delimiters for
arrays.

[1]: www.msgpack.org
@erickt
Copy link
Contributor

erickt commented Dec 27, 2012

This looks good to me. I'll merge this in in a couple minutes. In the future, can you base your pull requests off the "incoming" branch?

@erickt
Copy link
Contributor

erickt commented Dec 27, 2012

Unfortunately this is going to require a snapshot dance before it can land, so this may take a little time before I can commit.

@brson
Copy link
Contributor

brson commented Jan 14, 2013

I added the appropriate cfg attributes and pushed to incoming. Thanks!

@brson brson closed this Jan 14, 2013
@mneumann
Copy link
Contributor Author

great! finally I can try it out with my msgpack library. Thanks!

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.

3 participants