diff --git a/core/src/buffer.rs b/core/src/buffer.rs index e69ece89fb6..843421afdc7 100644 --- a/core/src/buffer.rs +++ b/core/src/buffer.rs @@ -37,6 +37,13 @@ use scale_info::{ #[derive(Clone, Default, Eq, Hash, Ord, PartialEq, PartialOrd, Decode, Encode, TypeInfo)] pub struct LimitedVec(Vec, PhantomData); +impl From<[T; M]> for LimitedVec { + fn from(value: [T; M]) -> Self { + assert!(M <= N); + Self(value.into(), Default::default()) + } +} + /// Formatter for [`LimitedVec`] will print to precision of 8 by default, to print the whole data, use `{:+}`. impl Display for LimitedVec where