MCPcopy Create free account
hub / github.com/SoftbearStudios/bitcode / clear

Method clear

src/fast.rs:79–88  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

77 }
78
79 pub fn clear(&mut self) {
80 // Safety: same as `Vec::clear` except `self.end = self.start` instead of `self.len = 0` but
81 // these are equivalent operations. Can't use `self.mut_vec(Vec::clear)` because T::drop
82 // panicking would double free elements.
83 unsafe {
84 let elems: *mut [T] = self.as_mut_slice();
85 self.end = self.start;
86 std::ptr::drop_in_place(elems);
87 }
88 }
89
90 pub fn reserve(&mut self, additional: usize) {
91 if additional > sub_ptr(self.capacity, self.end) {

Callers 15

collect_intoMethod · 0.80
bench_bincode_serializeFunction · 0.80
collect_intoMethod · 0.80
bench_pack_arithmeticFunction · 0.80
bench_unpack_arithmeticFunction · 0.80
with_allocationMethod · 0.80
into_allocationMethod · 0.80
set_ownedMethod · 0.80
bench_pushFunction · 0.80
bench_push_fastFunction · 0.80
bench_push_uncheckedFunction · 0.80

Calls 1

as_mut_sliceMethod · 0.80

Tested by

no test coverage detected