MCPcopy Index your code
hub / github.com/RustPython/RustPython / clone_from

Method clone_from

crates/common/src/boxvec.rs:601–615  ·  view source on GitHub ↗
(&mut self, rhs: &Self)

Source from the content-addressed store, hash-verified

599 }
600
601 fn clone_from(&mut self, rhs: &Self) {
602 // recursive case for the common prefix
603 let prefix = cmp::min(self.len(), rhs.len());
604 self[..prefix].clone_from_slice(&rhs[..prefix]);
605
606 if prefix < self.len() {
607 // rhs was shorter
608 for _ in 0..self.len() - prefix {
609 self.pop();
610 }
611 } else {
612 let rhs_elems = rhs[self.len()..].iter().cloned();
613 self.extend(rhs_elems);
614 }
615 }
616}
617
618impl<T> PartialEq for BoxVec<T>

Callers

nothing calls this directly

Calls 5

minFunction · 0.85
lenMethod · 0.45
popMethod · 0.45
iterMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected