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

Method clone_from

src/arrayvec.rs:122–138  ·  view source on GitHub ↗
(&mut self, o: &Self)

Source from the content-addressed store, hash-verified

120
121 #[inline]
122 fn clone_from(&mut self, o: &Self) {
123 let iter = self
124 .data
125 .as_slice_mut()
126 .iter_mut()
127 .zip(o.data.as_slice())
128 .take(self.len.max(o.len) as usize);
129 for (dst, src) in iter {
130 dst.clone_from(src)
131 }
132 if let Some(to_drop) =
133 self.data.as_slice_mut().get_mut((o.len as usize)..(self.len as usize))
134 {
135 to_drop.iter_mut().for_each(|x| drop(core::mem::take(x)));
136 }
137 self.len = o.len;
138 }
139}
140
141impl<A> Copy for ArrayVec<A>

Callers

nothing calls this directly

Calls 3

as_slice_mutMethod · 0.45
as_sliceMethod · 0.45
for_eachMethod · 0.45

Tested by

no test coverage detected