pub struct Patches { /* private fields */ }
Expand description
A helper for working with patched arrays.
Implementations§
Source§impl Patches
impl Patches
pub fn new( array_len: usize, offset: usize, indices: ArrayRef, values: ArrayRef, ) -> Self
Sourcepub fn new_unchecked(
array_len: usize,
offset: usize,
indices: ArrayRef,
values: ArrayRef,
) -> Self
pub fn new_unchecked( array_len: usize, offset: usize, indices: ArrayRef, values: ArrayRef, ) -> Self
Construct new patches without validating any of the arguments
§Safety
Users have to assert that
- Indices and values have the same length
- Indices is an unsigned integer type
- Indices must be sorted
- Last value in indices is smaller than array_len
pub fn into_parts(self) -> (usize, usize, ArrayRef, ArrayRef)
pub fn array_len(&self) -> usize
pub fn num_patches(&self) -> usize
pub fn dtype(&self) -> &DType
pub fn indices(&self) -> &ArrayRef
pub fn into_indices(self) -> ArrayRef
pub fn indices_mut(&mut self) -> &mut ArrayRef
pub fn values(&self) -> &ArrayRef
pub fn into_values(self) -> ArrayRef
pub fn values_mut(&mut self) -> &mut ArrayRef
pub fn offset(&self) -> usize
pub fn indices_ptype(&self) -> PType
pub fn to_metadata( &self, len: usize, dtype: &DType, ) -> VortexResult<PatchesMetadata>
pub fn cast_values(self, values_dtype: &DType) -> VortexResult<Self>
Sourcepub fn get_patched(&self, index: usize) -> VortexResult<Option<Scalar>>
pub fn get_patched(&self, index: usize) -> VortexResult<Option<Scalar>>
Get the patched value at a given index if it exists.
Sourcepub fn search_index(&self, index: usize) -> VortexResult<SearchResult>
pub fn search_index(&self, index: usize) -> VortexResult<SearchResult>
Return the insertion point of index
in the Self::indices.
Sourcepub fn search_sorted<T: Into<Scalar>>(
&self,
target: T,
side: SearchSortedSide,
) -> VortexResult<SearchResult>
pub fn search_sorted<T: Into<Scalar>>( &self, target: T, side: SearchSortedSide, ) -> VortexResult<SearchResult>
Return the search_sorted result for the given target re-mapped into the original indices.
Sourcepub fn min_index(&self) -> VortexResult<usize>
pub fn min_index(&self) -> VortexResult<usize>
Returns the minimum patch index
Sourcepub fn max_index(&self) -> VortexResult<usize>
pub fn max_index(&self) -> VortexResult<usize>
Returns the maximum patch index
Sourcepub fn filter(&self, mask: &Mask) -> VortexResult<Option<Self>>
pub fn filter(&self, mask: &Mask) -> VortexResult<Option<Self>>
Filter the patches by a mask, resulting in new patches for the filtered array.
Sourcepub fn slice(&self, start: usize, stop: usize) -> VortexResult<Option<Self>>
pub fn slice(&self, start: usize, stop: usize) -> VortexResult<Option<Self>>
Slice the patches by a range of the patched array.
Sourcepub fn take(&self, take_indices: &dyn Array) -> VortexResult<Option<Self>>
pub fn take(&self, take_indices: &dyn Array) -> VortexResult<Option<Self>>
Take the indices from the patches.
pub fn take_search( &self, take_indices: PrimitiveArray, ) -> VortexResult<Option<Self>>
pub fn take_map( &self, take_indices: PrimitiveArray, ) -> VortexResult<Option<Self>>
pub fn map_values<F>(self, f: F) -> VortexResult<Self>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Patches
impl !RefUnwindSafe for Patches
impl Send for Patches
impl Sync for Patches
impl Unpin for Patches
impl !UnwindSafe for Patches
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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