(input: &mut In)
| 25 | for VecOf<I, T, MAX_LEN> |
| 26 | { |
| 27 | fn decode<In: Input>(input: &mut In) -> Result<Self, scale::Error> { |
| 28 | let decoded_len = I::decode(input)?; |
| 29 | let len = decoded_len.into() as usize; |
| 30 | if len > MAX_LEN { |
| 31 | return Err("VecOf length exceeds upper bound".into()); |
| 32 | } |
| 33 | let mut inner = Vec::with_capacity(len.min(1024)); |
| 34 | for _ in 0..len { |
| 35 | inner.push(T::decode(input)?); |
| 36 | } |
| 37 | Ok(Self { |
| 38 | len: decoded_len, |
| 39 | inner, |
| 40 | }) |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | impl<I, T, const MAX_LEN: usize> VecOf<I, T, MAX_LEN> { |