Skip to content

Commit

Permalink
add fix vec
Browse files Browse the repository at this point in the history
  • Loading branch information
tickbh committed Jun 19, 2024
1 parent b0a2706 commit 948d805
Show file tree
Hide file tree
Showing 8 changed files with 769 additions and 14 deletions.
9 changes: 9 additions & 0 deletions examples/fix_vec.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use algorithm::FixedVec;
fn main() {
let mut val = FixedVec::new(5);
val.insert_head(1);
val.insert_head(2);
val.insert_head(3);
let _ = val.iter_mut().map(|(_, v)| *v = *v * 2).collect::<Vec<_>>();
assert_eq!(val.iter().map(|(_, v)| *v).collect::<Vec<_>>(), vec![6, 4, 2]);
}
Loading

0 comments on commit 948d805

Please sign in to comment.