Skip to content

Commit 4bb0dfe

Browse files
committed
use references in FixedSizeBytes
1 parent 6fc21da commit 4bb0dfe

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

heed-types/src/bytes.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ pub enum FixedSizeBytes<const N: usize> {}
3434
impl<'a, const N: usize> BytesEncode<'a> for FixedSizeBytes<N> {
3535
type EItem = [u8; N];
3636

37-
type ReturnBytes = [u8; N]; // TODO &'a [u8; N] or [u8; N]
37+
type ReturnBytes = &'a [u8; N];
3838

3939
type Error = Infallible;
4040

4141
fn bytes_encode(item: &'a Self::EItem) -> Result<Self::ReturnBytes, Self::Error> {
42-
Ok(*item)
42+
Ok(item)
4343
}
4444
}
4545

4646
impl<'a, const N: usize> BytesDecode<'a> for FixedSizeBytes<N> {
47-
type DItem = [u8; N]; // TODO &'a [u8; N] or [u8; N]
47+
type DItem = &'a [u8; N];
4848

4949
fn bytes_decode(bytes: &'a [u8]) -> Result<Self::DItem, BoxedError> {
5050
bytes.try_into().map_err(Into::into)

0 commit comments

Comments
 (0)