pub enum LoopPattern {
MapCollect {
iter_expr: PureExpr,
var_name: String,
target_var: String,
transform: PureExpr,
},
FilterCollect {
iter_expr: PureExpr,
var_name: String,
target_var: String,
condition: PureExpr,
},
FilterMapCollect {
iter_expr: PureExpr,
var_name: String,
target_var: String,
condition: PureExpr,
transform: PureExpr,
},
ForEach {
iter_expr: PureExpr,
var_name: String,
body: PureBlock,
},
}Expand description
Pattern detected in a for loop
Variants§
MapCollect
for x in iter { result.push(f(x)) } → iter.map(f).collect()
FilterCollect
for x in iter { if cond { result.push(x) } } → iter.filter(cond).collect()
FilterMapCollect
for x in iter { if cond { result.push(f(x)) } } → iter.filter(cond).map(f).collect()
Fields
ForEach
for x in iter { body } → iter.for_each(|x| body)
Trait Implementations§
Source§impl Clone for LoopPattern
impl Clone for LoopPattern
Source§fn clone(&self) -> LoopPattern
fn clone(&self) -> LoopPattern
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LoopPattern
impl Debug for LoopPattern
Source§impl PartialEq for LoopPattern
impl PartialEq for LoopPattern
Source§fn eq(&self, other: &LoopPattern) -> bool
fn eq(&self, other: &LoopPattern) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for LoopPattern
Auto Trait Implementations§
impl Freeze for LoopPattern
impl RefUnwindSafe for LoopPattern
impl Send for LoopPattern
impl Sync for LoopPattern
impl Unpin for LoopPattern
impl UnsafeUnpin for LoopPattern
impl UnwindSafe for LoopPattern
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