From 40fba080dc898197e5058634e4192cd36cc5c55c Mon Sep 17 00:00:00 2001 From: Bogdan Opanchuk Date: Thu, 3 Aug 2023 12:02:12 -0700 Subject: [PATCH] Add TryFrom<&[u8]> bound to Encoding::Repr --- src/traits.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/traits.rs b/src/traits.rs index b50000149..2695fbfd9 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -244,7 +244,12 @@ pub trait Bounded { /// Encoding support. pub trait Encoding: Sized { /// Byte array representation. - type Repr: AsRef<[u8]> + AsMut<[u8]> + Copy + Clone + Sized; + type Repr: AsRef<[u8]> + + AsMut<[u8]> + + Copy + + Clone + + Sized + + for<'a> TryFrom<&'a [u8], Error = core::array::TryFromSliceError>; /// Decode from big endian bytes. fn from_be_bytes(bytes: Self::Repr) -> Self;