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

Method slice

arrow-array/src/array/fixed_size_binary_array.rs:301–318  ·  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

299
300 /// Returns a zero-copy slice of this array with the indicated offset and length.
301 pub fn slice(&self, offset: usize, len: usize) -> Self {
302 assert!(
303 offset.saturating_add(len) <= self.len,
304 "the length + offset of the sliced FixedSizeBinaryArray cannot exceed the existing length"
305 );
306 let offset_bytes = offset
307 .checked_mul(self.value_size)
308 .expect("offset overflow");
309 let len_bytes = len.checked_mul(self.value_size).expect("offset overflow");
310
311 Self {
312 data_type: self.data_type.clone(),
313 nulls: self.nulls.as_ref().map(|n| n.slice(offset, len)),
314 value_size: self.value_size,
315 value_data: self.value_data.slice_with_length(offset_bytes, len_bytes),
316 len,
317 }
318 }
319
320 /// Create an array from an iterable argument of sparse byte slices.
321 /// Sparsity means that items returned by the iterator are optional, i.e input argument can

Callers 1

fromMethod · 0.45

Calls 4

slice_with_lengthMethod · 0.80
checked_mulMethod · 0.45
cloneMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected