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

Method from_slice_ref

arrow-buffer/src/buffer/immutable.rs:135–141  ·  view source on GitHub ↗

Initializes a [Buffer] from a slice of items.

(items: T)

Source from the content-addressed store, hash-verified

133
134 /// Initializes a [Buffer] from a slice of items.
135 pub fn from_slice_ref<U: ArrowNativeType, T: AsRef<[U]>>(items: T) -> Self {
136 let slice = items.as_ref();
137 let capacity = std::mem::size_of_val(slice);
138 let mut buffer = MutableBuffer::with_capacity(capacity);
139 buffer.extend_from_slice(slice);
140 buffer.into()
141 }
142
143 /// Creates a buffer from an existing memory region.
144 ///

Callers

nothing calls this directly

Calls 2

extend_from_sliceMethod · 0.80
as_refMethod · 0.45

Tested by

no test coverage detected