pub struct RowsBatchRef<'a, T> { /* private fields */ }
Expand description
This struct is similar to RowsBatch
, but it holds a reference to a slice of rows
(instead of an owned vector) and an offset in each row.
It is guaranteed that all rows in self.rows
have a length of at least row_len + offset
. The
effective row returned by row
method is &self.rows[index][self.offset..self.offset + self.row_len]
. Unfortunately, due to lifetime issues, we can’t unify RowsBatch
and
RowsBatchRef
into a single generic struct parameterized by the container type.
Implementations§
Source§impl<'a, T> RowsBatchRef<'a, T>
impl<'a, T> RowsBatchRef<'a, T>
Sourcepub fn new(rows: &'a [&'a [T]], row_len: usize) -> Self
pub fn new(rows: &'a [&'a [T]], row_len: usize) -> Self
Create a new RowsBatchRef
from a slice of rows and the given row length.
§Panics
In case if any of the rows has a length smaller than row_len
.
Sourcepub fn new_with_offset(
rows: &'a [&'a [T]],
offset: usize,
row_len: usize,
) -> Self
pub fn new_with_offset( rows: &'a [&'a [T]], offset: usize, row_len: usize, ) -> Self
Create a new RowsBatchRef
from a slice of rows and the given row length and offset.
§Panics
In case if any of the rows has a length smaller than from offset + row_len
.
Sourcepub unsafe fn new_unchecked(rows: &'a [&'a [T]], row_len: usize) -> Self
pub unsafe fn new_unchecked(rows: &'a [&'a [T]], row_len: usize) -> Self
Create a new RowsBatchRef
from a slice of rows and the given row length and offset.
§Safety
This function is unsafe because it does not check if the rows have the enough length.
It is the caller’s responsibility to ensure that row_len
is less than or equal
to the length of each row.
Sourcepub unsafe fn new_with_offset_unchecked(
rows: &'a [&'a [T]],
offset: usize,
row_len: usize,
) -> Self
pub unsafe fn new_with_offset_unchecked( rows: &'a [&'a [T]], offset: usize, row_len: usize, ) -> Self
Create a new RowsBatchRef
from a slice of rows and the given row length and offset.
§Safety
This function is unsafe because it does not check if the rows have the enough length.
It is the caller’s responsibility to ensure that offset + row_len
is less than or equal
to the length of each row.
pub fn iter(&self) -> impl Iterator<Item = &'a [T]> + '_
pub fn row(&self, index: usize) -> &'a [T]
pub fn n_rows(&self) -> usize
pub fn row_len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn map(&self, indices: impl AsRef<[usize]>) -> RowsBatch<'a, T>
pub fn map(&self, indices: impl AsRef<[usize]>) -> RowsBatch<'a, T>
Returns a new RowsBatch
with the specified rows selected by the given indices.
Sourcepub fn columns_subrange(&self, range: impl RangeBounds<usize>) -> Self
pub fn columns_subrange(&self, range: impl RangeBounds<usize>) -> Self
Returns a new RowsBatchRef
with the specified columns selected by the given indices range.
Auto Trait Implementations§
impl<'a, T> Freeze for RowsBatchRef<'a, T>
impl<'a, T> RefUnwindSafe for RowsBatchRef<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for RowsBatchRef<'a, T>where
T: Sync,
impl<'a, T> Sync for RowsBatchRef<'a, T>where
T: Sync,
impl<'a, T> Unpin for RowsBatchRef<'a, T>
impl<'a, T> UnwindSafe for RowsBatchRef<'a, T>where
T: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more