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

Element constructor for Array #19

Open
minghuaw opened this issue Aug 16, 2021 · 7 comments
Open

Element constructor for Array #19

minghuaw opened this issue Aug 16, 2021 · 7 comments

Comments

@minghuaw
Copy link

The AMQP 1.0 protocol specifies that Array (array8, and array32) should have the element constructor followed by a sequence of encoded values. The serializer implementation appears to serialize every element with every element's constructor. My understanding is that this is not really following the AMQP 1.0 protocol, is that right?

@djc
Copy link
Owner

djc commented Aug 17, 2021

It's certainly possible that I've gotten it wrong -- not sure how much I exercised the array code path. Would you be able to submit a PR?

@minghuaw
Copy link
Author

I am actually implementing my own serde crate for AMQP1.0, and I have List as the default serialization format for sequence types, and there is a wrapper Array which will be serialized as an array. I'm wondering if you could share any ideas on serializing the enums. I don't really have a good idea for the tuple variants and struct variants.

@djc
Copy link
Owner

djc commented Aug 21, 2021

Why are you implementing your own?

@minghuaw
Copy link
Author

I am trying to learn how serde works by implementing the AMQP1.0

@luos
Copy link

luos commented Nov 29, 2021

I think this is correct, this way Arrays are not serialised properly and if you try to send a sasl mechanism frame with this client it will be a deserialisation error on the other side. This makes it impossible to use this lib as a "server".

Unfortunately I could not find an easy way to fix this, because the serialiser can not serialise an array with type info and length prefixed to the contents, because there is no function on the Serialize trait to do something like write_raw_bytes. (And I am new to Rust and could not figure it out how to add it.)

Do you have any pointers how can this be worked around? Now I am just thinking that I will replace the whole Encoder part with one working directly with the different frames as dove does it.

@minghuaw
Copy link
Author

@luos I have a serde implementation of AMQP protocol, I was able to test exchanging AMQP frames with c#'s amqpnetlite. It is part of my hobby project trying to build an AMQP1.0 library, but it will be a standalone crate once everything is ready. I haven't made it public yet, and there is currently a lot of debugging messages, but I will be happy to remove those messages and publish a preview version on crates.io if you need that.

@luos
Copy link

luos commented Nov 29, 2021

Hi, thanks, my project is also only a hobby project (though a broker!), so no worries, I will implement it myself, I have to practice anyway. Thanks for the offer! 🙂

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

No branches or pull requests

3 participants