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

Method value

arrow-array/src/array/fixed_size_binary_array.rs:222–232  ·  view source on GitHub ↗

Returns the element at index `i` as a byte slice. Note: This method does not check for nulls and the value is arbitrary (but still well-defined) if [`is_null`](Self::is_null) returns true for the index. # Panics Panics if index `i` is out of bounds.

(&self, i: usize)

Source from the content-addressed store, hash-verified

220 /// # Panics
221 /// Panics if index `i` is out of bounds.
222 pub fn value(&self, i: usize) -> &[u8] {
223 let len = self.len();
224 assert!(
225 i < len,
226 "Trying to access an element at index {i} from a FixedSizeBinaryArray of length {len}",
227 );
228 let position = i * self.value_size;
229 unsafe {
230 std::slice::from_raw_parts(self.value_data.as_ptr().add(position), self.value_size)
231 }
232 }
233
234 /// Returns the element at index `i` as a byte slice.
235 ///

Calls 3

lenMethod · 0.45
addMethod · 0.45
as_ptrMethod · 0.45