mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-14 20:56:49 +00:00
start an ArrayVec extension trait
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
1 parent
0426f92ac0
commit
1e7207c230
2 files changed
+17
No files matched your search
@@ -0,0 +1,15 @@
|
||||
use ::arrayvec::ArrayVec;
|
||||
|
||||
pub trait ArrayVecExt<T> {
|
||||
fn extend_from_slice(&mut self, other: &[T]) -> &mut Self;
|
||||
}
|
||||
|
||||
impl<T: Copy, const CAP: usize> ArrayVecExt<T> for ArrayVec<T, CAP> {
|
||||
#[inline]
|
||||
fn extend_from_slice(&mut self, other: &[T]) -> &mut Self {
|
||||
self.try_extend_from_slice(other)
|
||||
.expect("Insufficient buffer capacity to extend from slice");
|
||||
|
||||
self
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user