Skip to content

Commit

Permalink
Implement insert for ArrayVec1.
Browse files Browse the repository at this point in the history
  • Loading branch information
olson-sean-k committed Jul 23, 2024
1 parent 7a732cd commit ee4b599
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/array_vec1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ where
self.many_or_get_only(|items| unsafe { items.pop().unwrap_maybe_unchecked() })
}

pub fn insert(&mut self, index: usize, item: T) {
self.items.insert(index, item)
}

pub fn insert_or_get_last(&mut self, index: usize, item: T) -> Result<(), (T, &T)> {
self.vacant_or_get_last(item, move |item, items| items.insert(index, item))
}
Expand Down

0 comments on commit ee4b599

Please sign in to comment.