pub struct LoopToIteratorMutation {
pub target_var: Option<String>,
pub aggressive: bool,
}Expand description
Convert for loops to iterator chains
Fields§
§target_var: Option<String>Only convert loops with this iterator variable name
aggressive: boolConvert to for_each even if no clear pattern
Implementations§
Source§impl LoopToIteratorMutation
impl LoopToIteratorMutation
pub fn new() -> Self
Sourcepub fn with_target(self, var: impl Into<String>) -> Self
pub fn with_target(self, var: impl Into<String>) -> Self
Only convert loops using a specific variable
Sourcepub fn aggressive(self) -> Self
pub fn aggressive(self) -> Self
Aggressively convert to for_each when no clear pattern
Sourcepub fn transform_block(&self, block: &mut PureBlock) -> usize
pub fn transform_block(&self, block: &mut PureBlock) -> usize
Transform for loops in a block (with block-level pattern detection)
Trait Implementations§
Source§impl Clone for LoopToIteratorMutation
impl Clone for LoopToIteratorMutation
Source§fn clone(&self) -> LoopToIteratorMutation
fn clone(&self) -> LoopToIteratorMutation
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 LoopToIteratorMutation
impl Debug for LoopToIteratorMutation
Source§impl Default for LoopToIteratorMutation
impl Default for LoopToIteratorMutation
Source§fn default() -> LoopToIteratorMutation
fn default() -> LoopToIteratorMutation
Returns the “default value” for a type. Read more
Source§impl Mutation for LoopToIteratorMutation
impl Mutation for LoopToIteratorMutation
Source§fn mutation_type(&self) -> &'static str
fn mutation_type(&self) -> &'static str
Get the mutation type name
Source§fn validate(&self, _file: &PureFile) -> ValidationResult
fn validate(&self, _file: &PureFile) -> ValidationResult
Validate the mutation before applying Read more
Source§fn can_proceed(&self, file: &PureFile, strategy: ValidationStrategy) -> bool
fn can_proceed(&self, file: &PureFile, strategy: ValidationStrategy) -> bool
Check if this mutation can proceed with the given strategy
Auto Trait Implementations§
impl Freeze for LoopToIteratorMutation
impl RefUnwindSafe for LoopToIteratorMutation
impl Send for LoopToIteratorMutation
impl Sync for LoopToIteratorMutation
impl Unpin for LoopToIteratorMutation
impl UnsafeUnpin for LoopToIteratorMutation
impl UnwindSafe for LoopToIteratorMutation
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