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

Method append

src/tinyvec.rs:636–645  ·  view source on GitHub ↗
(&mut self, other: &mut Self)

Source from the content-addressed store, hash-verified

634 /// Move all values from `other` into this vec.
635 #[inline]
636 pub fn append(&mut self, other: &mut Self) {
637 self.reserve(other.len());
638
639 /* Doing append should be faster, because it is effectively a memcpy */
640 match (self, other) {
641 (TinyVec::Heap(sh), TinyVec::Heap(oh)) => sh.append(oh),
642 (TinyVec::Inline(a), TinyVec::Heap(h)) => a.extend(h.drain(..)),
643 (ref mut this, TinyVec::Inline(arr)) => this.extend(arr.drain(..)),
644 }
645 }
646
647 impl_mirrored! {
648 type Mirror = TinyVec;

Callers 2

ArrayVec_appendFunction · 0.45

Calls 4

reserveMethod · 0.80
lenMethod · 0.45
extendMethod · 0.45
drainMethod · 0.45

Tested by 1

ArrayVec_appendFunction · 0.36