Open Stargateur opened 4 years ago
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)
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.
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.