Enum spirt::transform::Transformed
source · pub enum Transformed<T> {
Unchanged,
Changed(T),
}
Expand description
The result of a transformation (which is not in-place).
Variants§
Unchanged
The original T
value remains as it was, at no cost.
Changed(T)
Some part of the original T
value was transformed, and a new T
value
had to be constructed. This change will propagate in any “outer” value.
Implementations§
source§impl<T> Transformed<T>
impl<T> Transformed<T>
source§impl Transformed<()>
impl Transformed<()>
sourcepub fn map_iter<'a, T: 'a + Clone>(
iter: impl Iterator<Item = &'a T> + Clone + 'a,
transform_elem: impl FnMut(&'a T) -> Transformed<T> + 'a
) -> Transformed<impl Iterator<Item = T> + 'a>
pub fn map_iter<'a, T: 'a + Clone>( iter: impl Iterator<Item = &'a T> + Clone + 'a, transform_elem: impl FnMut(&'a T) -> Transformed<T> + 'a ) -> Transformed<impl Iterator<Item = T> + 'a>
Map every element of an iterator through transform_elem
and return
[Transformed::Changed(new_iter)
] if any transform_elem
call returned
Transformed::Changed
, with new_iter
containing a combination of the
changed elements, and clones of the unchanged elements.
Trait Implementations§
source§impl<T: Clone> Clone for Transformed<T>
impl<T: Clone> Clone for Transformed<T>
source§fn clone(&self) -> Transformed<T>
fn clone(&self) -> Transformed<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreimpl<T: Copy> Copy for Transformed<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for Transformed<T>where T: RefUnwindSafe,
impl<T> Send for Transformed<T>where T: Send,
impl<T> Sync for Transformed<T>where T: Sync,
impl<T> Unpin for Transformed<T>where T: Unpin,
impl<T> UnwindSafe for Transformed<T>where 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