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

Method as_slice

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

Source from the content-addressed store, hash-verified

261 /// ```
262 #[inline]
263 pub fn as_slice(&self) -> &[T] {
264 // SAFETY
265 //
266 // - MutableBuffer is aligned and initialized for len elements of T
267 // - MutableBuffer corresponds to a single allocation
268 // - MutableBuffer does not support modification whilst active immutable borrows
269 unsafe { std::slice::from_raw_parts(self.buffer.as_ptr() as _, self.len()) }
270 }
271
272 /// View the contents of this buffer as a mutable slice
273 ///

Calls 2

as_ptrMethod · 0.45
lenMethod · 0.45