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

Add support for serialization/deserialization #14

Closed
lzybkr opened this issue Mar 22, 2017 · 5 comments
Closed

Add support for serialization/deserialization #14

lzybkr opened this issue Mar 22, 2017 · 5 comments

Comments

@lzybkr
Copy link

lzybkr commented Mar 22, 2017

It would be useful if bit_set::BitSet supported serialization for serde. Today, if I add a BitSet to my struct, I get the following compiler errors because codegen can't automatically generate serialization for BitSet:

error[E0277]: the trait bound `bit_set::BitSet: serde::Serialize` is not satisfied
  --> src\coverage.rs:20:10
   |
20 | #[derive(Serialize, Deserialize)]
   |          ^^^^^^^^^ the trait `serde::Serialize` is not implemented for `bit_set::BitSet`
   |
   = note: required by `serde::ser::SerializeStruct::serialize_field`

error[E0277]: the trait bound `bit_set::BitSet: serde::Deserialize` is not satisfied
  --> src\coverage.rs:20:21
   |
20 | #[derive(Serialize, Deserialize)]
   |                     ^^^^^^^^^^^ the trait `serde::Deserialize` is not implemented for `bit_set::BitSet`
   |
   = note: required by `serde::de::SeqVisitor::visit`

error[E0277]: the trait bound `bit_set::BitSet: serde::Deserialize` is not satisfied
  --> src\coverage.rs:20:21
   |
20 | #[derive(Serialize, Deserialize)]
   |                     ^^^^^^^^^^^ the trait `serde::Deserialize` is not implemented for `bit_set::BitSet`
   |
   = note: required by `serde::de::MapVisitor::visit_value`

error[E0277]: the trait bound `bit_set::BitSet: serde::Deserialize` is not satisfied
  --> src\coverage.rs:20:21
   |
20 | #[derive(Serialize, Deserialize)]
   |                     ^^^^^^^^^^^ the trait `serde::Deserialize` is not implemented for `bit_set::BitSet`
   |
   = note: required by `serde::de::private::missing_field`
@HenningTimm
Copy link

I would be interested in this as well. However, it is not as simple as just adding #[derive(Serialize, Deserialize)], since BitSet uses a bit vector implementation that itself is also not serializable.

Also modifying BitVec would make this work. I will implement some tests and write a pull request for that.

@HenningTimm
Copy link

I created a branch that introduces serialization support (see here). I will create a PR once the PR for BitVec went through, since the changes there are required to make serialization for BitSet work.

@pczarn
Copy link
Contributor

pczarn commented Mar 11, 2019

@HenningTimm Thanks. I'll make sure the changes go through.

Edit: currently bit-set and bit-vec are in feature freeze mode, unfortunately.

@pczarn
Copy link
Contributor

pczarn commented Jul 3, 2024

The required changes to bit-vec are now there.

@pczarn
Copy link
Contributor

pczarn commented Dec 1, 2024

Fixed in #54

@pczarn pczarn closed this as completed Dec 1, 2024
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