Crates.io | bounded-vector |
lib.rs | bounded-vector |
version | |
source | src |
created_at | 2024-04-11 11:14:24.18593+00 |
updated_at | 2025-03-17 12:46:42.017269+00 |
description | Vec wrapper that guarantees upper and lower bounds on type level. |
homepage | |
repository | https://gitlab.com/fili_pk/bounded-vector |
max_upload_size | |
id | 1204728 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
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.
use bounded_vector::{BoundedVec, bvec};
let mut data: BoundedVec<u8, 2, 4> = [1, 2].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]);
Licensed under either of MIT or Apache-2.0 at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.