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

Method try_append

src/arrayvec.rs:332–348  ·  view source on GitHub ↗
(
    &mut self, other: &'other mut Self,
  )

Source from the content-addressed store, hash-verified

330 /// ```
331 #[inline]
332 pub fn try_append<'other>(
333 &mut self, other: &'other mut Self,
334 ) -> Option<&'other mut Self> {
335 let new_len = self.len() + other.len();
336 if new_len > A::CAPACITY {
337 return Some(other);
338 }
339
340 let iter = other.iter_mut().map(core::mem::take);
341 for item in iter {
342 self.push(item);
343 }
344
345 other.set_len(0);
346
347 return None;
348 }
349
350 /// A `*mut` pointer to the backing array.
351 ///

Callers

nothing calls this directly

Calls 3

lenMethod · 0.45
pushMethod · 0.45
set_lenMethod · 0.45

Tested by

no test coverage detected