-
Notifications
You must be signed in to change notification settings - Fork 36
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
Implement ser/der for QueuePairEndpoint #7
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I'm a little worried about forcing the interpretation of ibv_gid
as a global
— raw
is there for a reason. Is there maybe a way we can expose this in a way where the user has to assert that their QueuePairEndpoint
is in fact using global
before they can use it with PortableQPEndpoint
?
Encode that `Gid` is really just a `[u8;16]`. We also just apply `serde` directly to `QueuePairEndpoint` without exposing any implementation types. We can do this because `serde` can be applied to `Gid`.
Make some recommended changes for conversion traits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for sticking with all my requests for changes. Looks great now! 👍
Released in 0.4.5 and 0.5.0! |
Make
QueuePairEndpoint
serializable.I use the same essential strategy (and some of the code) as @kuenishi. The reason we can't just slap a
#[derive(Serialize, Deserialize)]
is thatQueuePairEndpoint
contains aC
styleunion
, whichserde
does not want to mess with. I get around this by providing idiomatic conversions from/toPortableQPEndpoint
, and telling serde to usePortableQPEndpoint
as an intermediary for serialization and deserialization.For a larger struct, you could implement custom serializers and deserializers, but this copy strategy works well for small structs.
I also implement
fmt::Debug
andPartialEq
forQueuePairEndpoint
.