MCPcopy Create free account
hub / github.com/apache/arrow-rs / truncate

Method truncate

arrow-buffer/src/buffer/mutable.rs:406–417  ·  view source on GitHub ↗
(&mut self, len: usize)

Source from the content-addressed store, hash-verified

404 /// If `len` is greater than the buffer's current length, this has no effect
405 #[inline(always)]
406 pub fn truncate(&mut self, len: usize) {
407 if len > self.len {
408 return;
409 }
410 self.len = len;
411 #[cfg(feature = "pool")]
412 {
413 if let Some(reservation) = self.reservation.lock().unwrap().as_mut() {
414 reservation.resize(self.len);
415 }
416 }
417 }
418
419 /// Resizes the buffer, either truncating its contents (with no change in capacity), or
420 /// growing it (potentially reallocating it) and writing `value` in the newly available bytes.

Callers 2

collect_boolMethod · 0.45
test_truncate_with_poolFunction · 0.45

Calls 1

resizeMethod · 0.45

Tested by 1

test_truncate_with_poolFunction · 0.36