pub enum Writes<'a> {
Offsets(&'a [usize]),
Walk {
base: usize,
steps: &'a [Steps],
},
}Expand description
Where a scatter writes: at flat offsets, or at the positions that steps reach from base, in the order walk reads them. A Steps::FILL offset, or a fill position, writes nothing. A walk writes without listing its positions.
Variants§
Implementations§
Source§impl<'a> Writes<'a>
impl<'a> Writes<'a>
Sourcepub fn listed(&self) -> Cow<'a, [usize]>
pub fn listed(&self) -> Cow<'a, [usize]>
The writes’ flat offsets, listing a walk’s positions (Steps::combined).
Sourcepub fn runs_while(&self, each: &mut dyn FnMut(usize, &[usize]) -> bool) -> bool
pub fn runs_while(&self, each: &mut dyn FnMut(usize, &[usize]) -> bool) -> bool
Calls each(k, run) with runs of the writes’ flat offsets, in order, where k is the place among the writes of the run’s first, until each gives false, and gives whether it went through every run. A fill gives Steps::FILL. Listed offsets are one run. A table of index values converts its own runs, as Table::chunks gives them. Other walks gather whole innermost axes into runs of about TABLE_CHUNK offsets (Steps::reached), so no walk is listed whole. each is a trait object, so the walk compiles once, and each caller’s loop over a run once.
Sourcepub fn only_fills(&self) -> bool
pub fn only_fills(&self) -> bool
Whether every write is at a fill, which writes nothing, as having no writes does.
Sourcepub fn write<S, D>(self, out: &mut [D], items: &[S], conv: impl Convert<S, D>)
pub fn write<S, D>(self, out: &mut [D], items: &[S], conv: impl Convert<S, D>)
Replaces the item of out at each write with the matching item of items, converted by conv, or with its only item, through scatter or scatter_walk. A later write wins.
Sourcepub fn combine<D, S, E>(
self,
out: &mut [D],
values: Arg<'_, S>,
f: impl Fn(D, S) -> (D, Option<E>),
) -> Option<E>
pub fn combine<D, S, E>( self, out: &mut [D], values: Arg<'_, S>, f: impl Fn(D, S) -> (D, Option<E>), ) -> Option<E>
Combines the matching item of values, or its only item, into the item of out at each write by f, in order, as out[o] = f(out[o], y).0. An out-of-range position writes nothing; a place that repeats combines again. With addition, this is the transpose of a gather that reads a position more than once. It gives the last failure that f reports.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Writes<'a>
impl<'a> !UnwindSafe for Writes<'a>
impl<'a> Forget for Writes<'a>
impl<'a> Freeze for Writes<'a>
impl<'a> Send for Writes<'a>
impl<'a> Sync for Writes<'a>
impl<'a> Unpin for Writes<'a>
impl<'a> UnsafeUnpin for Writes<'a>
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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