MCPcopy Create free account
hub / github.com/Lokathor/tinyvec / extend_from_slice

Method extend_from_slice

src/arrayvec.rs:466–485  ·  view source on GitHub ↗
(&mut self, sli: &[A::Item])

Source from the content-addressed store, hash-verified

464 /// * If the `ArrayVec` would overflow, this will panic.
465 #[inline]
466 pub fn extend_from_slice(&mut self, sli: &[A::Item])
467 where
468 A::Item: Clone,
469 {
470 if sli.is_empty() {
471 return;
472 }
473
474 let new_len = self.len as usize + sli.len();
475 assert!(
476 new_len <= A::CAPACITY,
477 "ArrayVec::extend_from_slice> total length {} exceeds capacity {}!",
478 new_len,
479 A::CAPACITY
480 );
481
482 let target = &mut self.data.as_slice_mut()[self.len as usize..new_len];
483 target.clone_from_slice(sli);
484 self.set_len(new_len);
485 }
486
487 /// Fill the vector until its capacity has been reached.
488 ///

Callers

nothing calls this directly

Calls 4

is_emptyMethod · 0.45
lenMethod · 0.45
as_slice_mutMethod · 0.45
set_lenMethod · 0.45

Tested by

no test coverage detected