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

Method value_unchecked

arrow-array/src/array/byte_view_array.rs:337–349  ·  view source on GitHub ↗

Returns the element at index `i` without bounds checking Note: This method does not check for nulls and the value is arbitrary if [`is_null`](Self::is_null) returns true for the index. # Safety Caller is responsible for ensuring that the index is within the bounds of the array

(&self, idx: usize)

Source from the content-addressed store, hash-verified

335 /// Caller is responsible for ensuring that the index is within the bounds
336 /// of the array
337 pub unsafe fn value_unchecked(&self, idx: usize) -> &T::Native {
338 let v = unsafe { self.views.get_unchecked(idx) };
339 let len = *v as u32;
340 let b = if len <= MAX_INLINE_VIEW_LEN {
341 unsafe { Self::inline_value(v, len as usize) }
342 } else {
343 let view = ByteView::from(*v);
344 let data = unsafe { self.buffers.get_unchecked(view.buffer_index as usize) };
345 let offset = view.offset as usize;
346 unsafe { data.get_unchecked(offset..offset + len as usize) }
347 };
348 unsafe { T::Native::from_bytes_unchecked(b) }
349 }
350
351 /// Returns the first `len` bytes the inline value of the view.
352 ///

Callers 2

valueMethod · 0.45
compare_uncheckedMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected