@@ -114,10 +114,13 @@ impl<'a, T: PrimitiveElement> Reader<'a, T> {
114
114
115
115
const _CHECK_SLICE: ( ) = check_slice_supported :: < T > ( ) ;
116
116
117
- /// Returns something if the slice is as expected in memory.
117
+ /// Attempts to return a view of the list as a native Rust slice.
118
+ /// Returns `None` if the elements of the list are non-contiguous,
119
+ /// which can happen if the schema has evolved.
118
120
///
119
- /// If the target is not little-endian or the `unaligned` feature is enabled, this function
120
- /// will only be available for types that are 1 byte or smaller.
121
+ /// This method raises a compile-time error if `T` is larger than one
122
+ /// byte and either the `unaligned` feature is enabled or the target
123
+ /// is big-endian.
121
124
pub fn as_slice ( & self ) -> Option < & [ T ] > {
122
125
let ( ) = Self :: _CHECK_SLICE;
123
126
if self . reader . get_element_size ( ) == T :: element_size ( ) {
@@ -196,6 +199,13 @@ where
196
199
197
200
const _CHECK_SLICE: ( ) = check_slice_supported :: < T > ( ) ;
198
201
202
+ /// Attempts to return a view of the list as a native Rust slice.
203
+ /// Returns `None` if the elements of the list are non-contiguous,
204
+ /// which can happen if the schema has evolved.
205
+ ///
206
+ /// This method raises a compile-time error if `T` is larger than one
207
+ /// byte and either the `unaligned` feature is enabled or the target
208
+ /// is big-endian.
199
209
pub fn as_slice ( & mut self ) -> Option < & mut [ T ] > {
200
210
let ( ) = Self :: _CHECK_SLICE;
201
211
if self . builder . get_element_size ( ) == T :: element_size ( ) {
0 commit comments