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

Method slice

arrow-array/src/array/struct_array.rs:331–345  ·  view source on GitHub ↗

Returns a zero-copy slice of this array with the indicated offset and length.

(&self, offset: usize, len: usize)

Source from the content-addressed store, hash-verified

329
330 /// Returns a zero-copy slice of this array with the indicated offset and length.
331 pub fn slice(&self, offset: usize, len: usize) -> Self {
332 assert!(
333 offset.saturating_add(len) <= self.len,
334 "the length + offset of the sliced StructArray cannot exceed the existing length"
335 );
336
337 let fields = self.fields.iter().map(|a| a.slice(offset, len)).collect();
338
339 Self {
340 len,
341 data_type: self.data_type.clone(),
342 nulls: self.nulls.as_ref().map(|n| n.slice(offset, len)),
343 fields,
344 }
345 }
346
347 /// Returns the children of this [`StructArray`] with the struct's validity
348 /// bitmap AND'd into each child's validity bitmap.

Callers 4

fromMethod · 0.45
test_struct_array_sliceFunction · 0.45

Calls 4

collectMethod · 0.80
iterMethod · 0.45
cloneMethod · 0.45
as_refMethod · 0.45