pub struct RewriteOpts {
pub max_iterations: usize,
pub strategy: RewriteStrategy,
}Expand description
Options controlling Ex::rewrite_with.
§Examples
use symplex::macros::{RewriteOpts, RewriteStrategy};
let opts = RewriteOpts { max_iterations: 5, strategy: RewriteStrategy::TopDown };
assert_eq!(opts.max_iterations, 5);
assert_eq!(RewriteOpts::default().strategy, RewriteStrategy::BottomUp);Fields§
§max_iterations: usizeMaximum number of full passes over the expression (default 50).
Rewriting stops early as soon as a pass changes nothing.
strategy: RewriteStrategyTraversal order (default RewriteStrategy::BottomUp).
Implementations§
Source§impl RewriteOpts
impl RewriteOpts
Sourcepub fn single_pass() -> Self
pub fn single_pass() -> Self
Exactly one pass, bottom-up.
Sourcepub fn max_iterations(self, n: usize) -> Self
pub fn max_iterations(self, n: usize) -> Self
Builder: set the iteration cap.
Sourcepub fn strategy(self, strategy: RewriteStrategy) -> Self
pub fn strategy(self, strategy: RewriteStrategy) -> Self
Builder: set the traversal strategy.
Trait Implementations§
Source§impl Clone for RewriteOpts
impl Clone for RewriteOpts
Source§fn clone(&self) -> RewriteOpts
fn clone(&self) -> RewriteOpts
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 RewriteOpts
impl Debug for RewriteOpts
Source§impl Default for RewriteOpts
impl Default for RewriteOpts
impl Eq for RewriteOpts
Source§impl PartialEq for RewriteOpts
impl PartialEq for RewriteOpts
impl StructuralPartialEq for RewriteOpts
Auto Trait Implementations§
impl Freeze for RewriteOpts
impl RefUnwindSafe for RewriteOpts
impl Send for RewriteOpts
impl Sync for RewriteOpts
impl Unpin for RewriteOpts
impl UnsafeUnpin for RewriteOpts
impl UnwindSafe for RewriteOpts
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
Converts
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> ⓘ
Converts
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