Closed robin-nitrokey closed 1 year ago
It's a bit of a pain that dtolnay completely ignores my pr to serde_bytes.
Maybe we should publish a fork of serde-bytes as serde-bytes-array
? We already needed something like this in opcard (though we don't anymore).
Maybe we should publish a fork of serde-bytes as
serde-bytes-array
? We already needed something like this in opcard (though we don't anymore).
Does this have to be a fork? Can’t we have a serde-byte(s)-array
crate that just provides the Byte(s)Array
type and, if needed, depends on serde-bytes
?
It doesn't necessarily have to be a fork no. We could have just the [u8;N]
support in its own crate.
Maybe it could be part of heapless-bytes?
I’d prefer a separate crate. Mabye other people are also interested in using this specialization without pulling in heapless
.
I pushed one at https://github.com/Nitrokey/serde-byte-array
I pushed one at https://github.com/Nitrokey/serde-byte-array
404 – is it a private repository?
I made it public Should we publish it on crates.io?
Thanks! I’ll make a PR with some minor changes and then we can release.
Per default, byte arrays are serialized inefficiently by serde.
serde_bytes provides workarounds for byte slice serialization but does not support arrays yet. heapless_bytes improves the serialization for arrays but does not guarantee their length. Therefore we introduce a helper type, BytesArray, that uses heapless_bytes’ serialization but enforces a constant length.serde-byte-array provides a wrapper type with a more efficient serialization format.
Fixes https://github.com/trussed-dev/trussed-auth/issues/11