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

serde support #25

Closed
zhangsoledad opened this issue Jan 13, 2023 · 3 comments · Fixed by #28
Closed

serde support #25

zhangsoledad opened this issue Jan 13, 2023 · 3 comments · Fixed by #28
Labels
enhancement New feature or request

Comments

@zhangsoledad
Copy link
Member

zhangsoledad commented Jan 13, 2023

Some design is needed,
to be as generic as possible while still meeting existing requirements https://github.com/nervosnetwork/ckb/blob/develop/util/jsonrpc-types/src/bytes.rs.
Support configuration 0x-prefix, case-sensitive, bytes/Vec, etc.

@zhangsoledad zhangsoledad added the enhancement New feature or request label Jan 13, 2023
@eval-exec
Copy link
Collaborator

eval-exec commented Feb 1, 2023

proposal

Inspired by serde-hex, I want to make faster-hex cooperate with serde in such usages:

// will get 0x prefixed, lower case hex string, like: "0x01020a0b"
struct Foo {
  #[serde(with = "faster_hex::SerHex::<StrictPfx>")]
  bar: Vec<u8>
}
// will get no 0x prefixed, lower case hex string, like: "01020a0b"
struct Foo {
  #[serde(with = "faster_hex::SerHex::<Strict>")]
  bar: Vec<u8>
}
// will get no 0x prefixed, upper case hex string, like: "01020A0B"
struct Foo {
  #[serde(with = "faster_hex::SerHex::<StrictCap>")]
  bar: Vec<u8>
}
// will 0x prefixed, upper case hex string, like: "0x01020A0B"
struct Foo {
  #[serde(with = "faster_hex::SerHex::<StrictPfxCap>")]
  bar: Vec<u8>
}

I want add two features to faster-hex

feature serde

This feature allow serde to de/serialize Vec<u8> field.

feature serde_bytes

This feature will depend on bytes crate, and allow serde to de/serialize Bytes field.

@SuperFluffy
Copy link

Found this feature and wanted to use it, but it's not yet released crates.io. :( Do you have plans to cut a new release?

@eval-exec
Copy link
Collaborator

@SuperFluffy Yes, future release planned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants