@@ -302,7 +302,7 @@ impl<T: ByteViewType + ?Sized> GenericByteViewArray<T> {
302
302
ArrayIter :: new ( self )
303
303
}
304
304
305
- /// Returns an iterator over the bytes of this array.
305
+ /// Returns an iterator over the bytes of this array, including null values
306
306
pub fn bytes_iter ( & self ) -> impl Iterator < Item = & [ u8 ] > {
307
307
self . views . iter ( ) . map ( move |v| {
308
308
let len = * v as u32 ;
@@ -317,8 +317,11 @@ impl<T: ByteViewType + ?Sized> GenericByteViewArray<T> {
317
317
} )
318
318
}
319
319
320
- /// Returns an iterator over the prefix bytes of this array with respect to the prefix length.
321
- /// If the prefix length is larger than the string length, it will return the empty slice.
320
+ /// Returns an iterator over the first `prefix_len` bytes of each array
321
+ /// element, including null values.
322
+ ///
323
+ /// If `prefix_len` is larger than the element's length, the iterator will
324
+ /// return an empty slice (`&[]`).
322
325
pub fn prefix_bytes_iter ( & self , prefix_len : usize ) -> impl Iterator < Item = & [ u8 ] > {
323
326
self . views ( ) . into_iter ( ) . map ( move |v| {
324
327
let len = ( * v as u32 ) as usize ;
@@ -341,8 +344,14 @@ impl<T: ByteViewType + ?Sized> GenericByteViewArray<T> {
341
344
} )
342
345
}
343
346
344
- /// Returns an iterator over the suffix bytes of this array with respect to the suffix length.
345
- /// If the suffix length is larger than the string length, it will return the empty slice.
347
+ /// Returns an iterator over the last `suffix_len` bytes of each array
348
+ /// element, including null values.
349
+ ///
350
+ /// Note that for [`StringViewArray`] the last bytes may start in the middle
351
+ /// of a UTF-8 codepoint, and thus may not be a valid `&str`.
352
+ ///
353
+ /// If `suffix_len` is larger than the element's length, the iterator will
354
+ /// return an empty slice (`&[]`).
346
355
pub fn suffix_bytes_iter ( & self , suffix_len : usize ) -> impl Iterator < Item = & [ u8 ] > {
347
356
self . views ( ) . into_iter ( ) . map ( move |v| {
348
357
let len = ( * v as u32 ) as usize ;
0 commit comments