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

Method set_len

crates/common/src/boxvec.rs:224–227  ·  view source on GitHub ↗

Set the vector’s length without dropping or moving out elements This method is `unsafe` because it changes the notion of the number of “valid” elements in the vector. Use with care. This method uses *debug assertions* to check that `length` is not greater than the capacity. # Safety Must ensure that length <= self.capacity()

(&mut self, length: usize)

Source from the content-addressed store, hash-verified

222 /// # Safety
223 /// Must ensure that length <= self.capacity()
224 pub unsafe fn set_len(&mut self, length: usize) {
225 debug_assert!(length <= self.capacity());
226 self.len = length;
227 }
228
229 /// Copy and appends all elements in a slice to the `BoxVec`.
230 ///

Callers 15

recvMethod · 0.80
recvfromMethod · 0.80
recvmsgMethod · 0.80
readMethod · 0.80
subscriptMethod · 0.80
obj2txtFunction · 0.80
push_uncheckedMethod · 0.80
try_insertMethod · 0.80
popMethod · 0.80
try_extend_from_sliceMethod · 0.80
next_backMethod · 0.80
dropMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected