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

A Struct Hex ? #47

Open
Stargateur opened this issue Aug 17, 2020 · 0 comments
Open

A Struct Hex ? #47

Stargateur opened this issue Aug 17, 2020 · 0 comments

Comments

@Stargateur
Copy link

Stargateur commented Aug 17, 2020

Could be nice to have a struct that enforce at compile time that a string is expected to be Hex encoded.

struct HexString(String);
struct HexSlice<'a>(&'a str)

The idea behind this is related to mongodb gridfs, the field md5 is expected to be Hex encoded, so I though, wouldn't be nice to have a struct that ensure a field is hex encoded ?

This is common in TLS crate for example, https://docs.rs/native-tls/0.2.4/native_tls/struct.Certificate.html.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants