pub struct OptIter<'a, V: Vec1View<T>, T> {
pub view: &'a V,
pub item: PhantomData<T>,
}Expand description
An iterator adapter that wraps a Vec1View and converts its items to Option types.
This struct provides a way to iterate over a Vec1View while converting each item
to an Option type. It’s particularly useful when working with types that implement
the IsNone trait, allowing for a uniform representation of potentially absent values.
§Type Parameters
'a: The lifetime of the reference to the underlyingVec1View.V: The type of the underlyingVec1View.T: The item type of theVec1View.
§Fields
view: A reference to the underlyingVec1View.item: APhantomDatato carry the item typeT.
Fields§
§view: &'a V§item: PhantomData<T>Trait Implementations§
Source§impl<'a, 'b, V: Vec1View<T>, T: IsNone> IntoIterator for &'b OptIter<'a, V, T>
impl<'a, 'b, V: Vec1View<T>, T: IsNone> IntoIterator for &'b OptIter<'a, V, T>
Source§impl<V: Vec1View<T>, T: IsNone> TIter<Option<<T as IsNone>::Inner>> for OptIter<'_, V, T>
impl<V: Vec1View<T>, T: IsNone> TIter<Option<<T as IsNone>::Inner>> for OptIter<'_, V, T>
Source§impl<'a, T: IsNone + 'a, V: Vec1View<T>> Vec1View<Option<<T as IsNone>::Inner>> for OptIter<'a, V, T>where
for<'b> V::SliceOutput<'b>: TIter<T>,
impl<'a, T: IsNone + 'a, V: Vec1View<T>> Vec1View<Option<<T as IsNone>::Inner>> for OptIter<'a, V, T>where
for<'b> V::SliceOutput<'b>: TIter<T>,
type SliceOutput<'b> = Vec<Option<<T as IsNone>::Inner>> where Self: 'b
Source§fn slice<'b>(
&'b self,
start: usize,
end: usize,
) -> TResult<Self::SliceOutput<'b>>where
T: 'b,
fn slice<'b>(
&'b self,
start: usize,
end: usize,
) -> TResult<Self::SliceOutput<'b>>where
T: 'b,
Attempts to create a slice of the vector from the given start and end indices. Read more
Source§fn get_backend_name(&self) -> &'static str
fn get_backend_name(&self) -> &'static str
Returns the name of the backend implementation. Read more
Source§unsafe fn uslice<'a>(
&'a self,
start: usize,
end: usize,
) -> TResult<Self::SliceOutput<'a>>where
T: 'a,
unsafe fn uslice<'a>(
&'a self,
start: usize,
end: usize,
) -> TResult<Self::SliceOutput<'a>>where
T: 'a,
Creates an unsafe slice of the vector from the given start and end indices. Read more
Source§fn try_as_slice(&self) -> Option<&[T]>
fn try_as_slice(&self) -> Option<&[T]>
Attempts to return a reference to the underlying slice of the vector. Read more
Source§fn iter_cast<'a, U>(&'a self) -> impl TIterator<Item = U>where
T: 'a + Cast<U>,
fn iter_cast<'a, U>(&'a self) -> impl TIterator<Item = U>where
T: 'a + Cast<U>,
Creates an iterator that casts each element of the vector to a new type. Read more
Source§fn opt_iter_cast<'a, U>(&'a self) -> impl TIterator<Item = Option<U>>
fn opt_iter_cast<'a, U>(&'a self) -> impl TIterator<Item = Option<U>>
Creates an iterator that optionally casts each element of the vector to a new type. Read more
Source§fn to_opt_iter<'a>(&'a self) -> impl TIterator<Item = Option<T::Inner>>where
T: IsNone + 'a,
fn to_opt_iter<'a>(&'a self) -> impl TIterator<Item = Option<T::Inner>>where
T: IsNone + 'a,
Creates an iterator that converts each element of the vector to an
Option. Read moreSource§unsafe fn uvget(&self, index: usize) -> Option<T::Inner>where
T: IsNone,
unsafe fn uvget(&self, index: usize) -> Option<T::Inner>where
T: IsNone,
Retrieves the value at the specified index as an
Option, if it’s valid. Read moreSource§fn get(&self, index: usize) -> TResult<T>
fn get(&self, index: usize) -> TResult<T>
Safely retrieves the value at the specified index. Read more
Source§fn vget(&self, index: usize) -> Option<T::Inner>where
T: IsNone,
fn vget(&self, index: usize) -> Option<T::Inner>where
T: IsNone,
Safely retrieves the value at the specified index as an
Option. Read moreSource§fn rolling_custom_iter<'a, U, F>(
&'a self,
window: usize,
f: F,
) -> impl TrustedLen<Item = U>where
F: FnMut(Self::SliceOutput<'a>) -> U,
T: 'a,
fn rolling_custom_iter<'a, U, F>(
&'a self,
window: usize,
f: F,
) -> impl TrustedLen<Item = U>where
F: FnMut(Self::SliceOutput<'a>) -> U,
T: 'a,
Applies a custom function to rolling windows of the vector. Read more
Source§fn rolling_custom<'a, O: Vec1<OT>, OT: Clone, F>(
&'a self,
window: usize,
f: F,
out: Option<O::UninitRefMut<'_>>,
) -> Option<O>where
F: FnMut(Self::SliceOutput<'a>) -> OT,
Self: 'a,
T: 'a,
fn rolling_custom<'a, O: Vec1<OT>, OT: Clone, F>(
&'a self,
window: usize,
f: F,
out: Option<O::UninitRefMut<'_>>,
) -> Option<O>where
F: FnMut(Self::SliceOutput<'a>) -> OT,
Self: 'a,
T: 'a,
Applies a custom function to rolling windows of the vector and collects the results. Read more
Source§fn rolling_custom_to<'a, O: Vec1<OT>, OT, F>(
&'a self,
window: usize,
f: F,
out: O::UninitRefMut<'_>,
)where
F: FnMut(Self::SliceOutput<'a>) -> OT,
Self: 'a,
T: 'a,
fn rolling_custom_to<'a, O: Vec1<OT>, OT, F>(
&'a self,
window: usize,
f: F,
out: O::UninitRefMut<'_>,
)where
F: FnMut(Self::SliceOutput<'a>) -> OT,
Self: 'a,
T: 'a,
Applies a custom function to rolling windows of the vector and writes the results to a provided buffer. Read more
Source§fn rolling2_custom<O: Vec1<OT>, OT: Clone, V2, T2, F>(
&self,
other: &V2,
window: usize,
f: F,
out: Option<O::UninitRefMut<'_>>,
) -> Option<O>
fn rolling2_custom<O: Vec1<OT>, OT: Clone, V2, T2, F>( &self, other: &V2, window: usize, f: F, out: Option<O::UninitRefMut<'_>>, ) -> Option<O>
Applies a custom function to rolling windows of two vectors simultaneously. Read more
Source§fn rolling_apply<O: Vec1<OT>, OT, F>(
&self,
window: usize,
f: F,
out: Option<O::UninitRefMut<'_>>,
) -> Option<O>
fn rolling_apply<O: Vec1<OT>, OT, F>( &self, window: usize, f: F, out: Option<O::UninitRefMut<'_>>, ) -> Option<O>
Applies a rolling function that considers both the removal and addition of elements in the window. Read more
Source§fn rolling_apply_to<O: Vec1<OT>, OT, F>(
&self,
window: usize,
f: F,
out: O::UninitRefMut<'_>,
)
fn rolling_apply_to<O: Vec1<OT>, OT, F>( &self, window: usize, f: F, out: O::UninitRefMut<'_>, )
Applies a rolling function that considers both the removal and addition of elements in the window,
writing results to a provided buffer. Read more
Source§fn rolling2_apply<O: Vec1<OT>, OT, V2: Vec1View<T2>, T2, F>(
&self,
other: &V2,
window: usize,
f: F,
out: Option<O::UninitRefMut<'_>>,
) -> Option<O>
fn rolling2_apply<O: Vec1<OT>, OT, V2: Vec1View<T2>, T2, F>( &self, other: &V2, window: usize, f: F, out: Option<O::UninitRefMut<'_>>, ) -> Option<O>
Applies a rolling function to two vectors simultaneously, considering both
the removal and addition of elements in the window. Read more
Source§fn rolling2_apply_to<O: Vec1<OT>, OT, V2: Vec1View<T2>, T2, F>(
&self,
other: &V2,
window: usize,
f: F,
out: O::UninitRefMut<'_>,
)
fn rolling2_apply_to<O: Vec1<OT>, OT, V2: Vec1View<T2>, T2, F>( &self, other: &V2, window: usize, f: F, out: O::UninitRefMut<'_>, )
Applies a rolling function to two vectors simultaneously, writing results to a provided buffer. Read more
Source§fn rolling_apply_idx<O: Vec1<OT>, OT, F>(
&self,
window: usize,
f: F,
out: Option<O::UninitRefMut<'_>>,
) -> Option<O>
fn rolling_apply_idx<O: Vec1<OT>, OT, F>( &self, window: usize, f: F, out: Option<O::UninitRefMut<'_>>, ) -> Option<O>
Applies a rolling function that considers the index of elements in the window. Read more
Source§fn rolling_apply_idx_to<O: Vec1<OT>, OT, F>(
&self,
window: usize,
f: F,
out: O::UninitRefMut<'_>,
)
fn rolling_apply_idx_to<O: Vec1<OT>, OT, F>( &self, window: usize, f: F, out: O::UninitRefMut<'_>, )
Applies a rolling function that considers the index of elements in the window,
writing results to a provided buffer. Read more
Source§fn rolling2_apply_idx<O: Vec1<OT>, OT, V2: Vec1View<T2>, T2, F>(
&self,
other: &V2,
window: usize,
f: F,
out: Option<O::UninitRefMut<'_>>,
) -> Option<O>
fn rolling2_apply_idx<O: Vec1<OT>, OT, V2: Vec1View<T2>, T2, F>( &self, other: &V2, window: usize, f: F, out: Option<O::UninitRefMut<'_>>, ) -> Option<O>
Applies a rolling function to two vectors simultaneously, considering the index of elements in the window. Read more
Source§fn rolling2_apply_idx_to<O: Vec1<OT>, OT, V2: Vec1View<T2>, T2, F>(
&self,
other: &V2,
window: usize,
f: F,
out: O::UninitRefMut<'_>,
)
fn rolling2_apply_idx_to<O: Vec1<OT>, OT, V2: Vec1View<T2>, T2, F>( &self, other: &V2, window: usize, f: F, out: O::UninitRefMut<'_>, )
Applies a rolling function to two vectors simultaneously, considering the index of elements in the window,
writing results to a provided buffer. Read more
Auto Trait Implementations§
impl<'a, V, T> Freeze for OptIter<'a, V, T>
impl<'a, V, T> RefUnwindSafe for OptIter<'a, V, T>where
V: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, V, T> Send for OptIter<'a, V, T>
impl<'a, V, T> Sync for OptIter<'a, V, T>
impl<'a, V, T> Unpin for OptIter<'a, V, T>where
T: Unpin,
impl<'a, V, T> UnwindSafe for OptIter<'a, V, T>where
V: RefUnwindSafe,
T: UnwindSafe,
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