start an ArrayVec extension trait
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
15
src/core/utils/arrayvec.rs
Normal file
15
src/core/utils/arrayvec.rs
Normal file
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
pub mod arrayvec;
|
||||||
pub mod bool;
|
pub mod bool;
|
||||||
pub mod bytes;
|
pub mod bytes;
|
||||||
pub mod content_disposition;
|
pub mod content_disposition;
|
||||||
@@ -22,6 +23,7 @@ pub use ::conduit_macros::implement;
|
|||||||
pub use ::ctor::{ctor, dtor};
|
pub use ::ctor::{ctor, dtor};
|
||||||
|
|
||||||
pub use self::{
|
pub use self::{
|
||||||
|
arrayvec::ArrayVecExt,
|
||||||
bool::BoolExt,
|
bool::BoolExt,
|
||||||
bytes::{increment, u64_from_bytes, u64_from_u8, u64_from_u8x8},
|
bytes::{increment, u64_from_bytes, u64_from_u8, u64_from_u8x8},
|
||||||
debug::slice_truncated as debug_slice_truncated,
|
debug::slice_truncated as debug_slice_truncated,
|
||||||
|
|||||||
Reference in New Issue
Block a user