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

Method as_slice_mut

arrow-buffer/src/builder/mod.rs:287–294  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

285 /// ```
286 #[inline]
287 pub fn as_slice_mut(&mut self) -> &mut [T] {
288 // SAFETY
289 //
290 // - MutableBuffer is aligned and initialized for len elements of T
291 // - MutableBuffer corresponds to a single allocation
292 // - MutableBuffer does not support modification whilst active immutable borrows
293 unsafe { std::slice::from_raw_parts_mut(self.buffer.as_mut_ptr() as _, self.len()) }
294 }
295
296 /// Shorten this BufferBuilder to `len` items
297 ///

Calls 2

as_mut_ptrMethod · 0.80
lenMethod · 0.45