We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6fc21da commit 4bb0dfeCopy full SHA for 4bb0dfe
heed-types/src/bytes.rs
@@ -34,17 +34,17 @@ pub enum FixedSizeBytes<const N: usize> {}
34
impl<'a, const N: usize> BytesEncode<'a> for FixedSizeBytes<N> {
35
type EItem = [u8; N];
36
37
- type ReturnBytes = [u8; N]; // TODO &'a [u8; N] or [u8; N]
+ type ReturnBytes = &'a [u8; N];
38
39
type Error = Infallible;
40
41
fn bytes_encode(item: &'a Self::EItem) -> Result<Self::ReturnBytes, Self::Error> {
42
- Ok(*item)
+ Ok(item)
43
}
44
45
46
impl<'a, const N: usize> BytesDecode<'a> for FixedSizeBytes<N> {
47
- type DItem = [u8; N]; // TODO &'a [u8; N] or [u8; N]
+ type DItem = &'a [u8; N];
48
49
fn bytes_decode(bytes: &'a [u8]) -> Result<Self::DItem, BoxedError> {
50
bytes.try_into().map_err(Into::into)
0 commit comments