corda-rpc
corda-rpc copied to clipboard
Element constructor for Array
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?
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?
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.
Why are you implementing your own?
I am trying to learn how serde works by implementing the AMQP1.0
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.
@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.
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! 🙂