Expand description
BoundedVec<T, LOW, UPP>
- Vec wrapper that guarantees upper and lower bounds on type level.
Alternative to bounded-vec that offers compatibility with empty vector, has more methods and bvec!
that works like vec! macro.
Example
use bounded_vector::{BoundedVec, bvec};
let mut data: BoundedVec<u8, 2, 4> = [1, 2].try_into()?;
assert_eq!(data.first(), Some(&1));
assert_eq!(data.last(), Some(&2));
data.iter_mut().for_each(|x| *x *= 2);
assert_eq!(data, bvec![2, 4]);
Macros§
- bvec
- Macro similar to vec!
Structs§
- Bounded
Vec - Bounded Vec with minimal (L - lower bound) and maximal (U - upper bound) length
Enums§
- Error
- Errors used by BoundedVec