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

Method from_trusted_len_iter

arrow-array/src/array/primitive_array.rs:1488–1501  ·  view source on GitHub ↗
(iter: I)

Source from the content-addressed store, hash-verified

1486 /// I.e. that `size_hint().1` correctly reports its length.
1487 #[inline]
1488 pub unsafe fn from_trusted_len_iter<I, P>(iter: I) -> Self
1489 where
1490 P: std::borrow::Borrow<Option<<T as ArrowPrimitiveType>::Native>>,
1491 I: IntoIterator<Item = P>,
1492 {
1493 let iterator = iter.into_iter();
1494 let (_, upper) = iterator.size_hint();
1495 let len = upper.expect("trusted_len_unzip requires an upper limit");
1496
1497 let (null, buffer) = unsafe { trusted_len_unzip(iterator) };
1498
1499 let nulls = NullBuffer::from_unsliced_buffer(null, len);
1500 PrimitiveArray::new(ScalarBuffer::from(buffer), nulls)
1501 }
1502}
1503
1504// TODO: the macro is needed here because we'd get "conflicting implementations" error

Callers

nothing calls this directly

Calls 3

trusted_len_unzipFunction · 0.85
into_iterMethod · 0.45
size_hintMethod · 0.45

Tested by

no test coverage detected