pub enum RustPattern {
MethodCall {
method: &'static str,
extra_args: Vec<&'static str>,
propagate_error: bool,
},
PropertyToMethod {
method: &'static str,
propagate_error: bool,
},
IterationPattern {
iter_method: &'static str,
element_type: Option<&'static str>,
yields_results: bool,
},
CustomTemplate {
template: &'static str,
},
}Expand description
Defines how to generate Rust code for a Python pattern
Variants§
MethodCall
Simple method call: obj.method(args)
Fields
PropertyToMethod
Property access becomes method call: obj.property → obj.method()
IterationPattern
Custom iteration pattern
Fields
CustomTemplate
Custom code template with {var} placeholders
Implementations§
Source§impl RustPattern
Helper for generating Rust code from patterns
impl RustPattern
Helper for generating Rust code from patterns
Sourcepub fn generate_rust_code(
&self,
base_expr: &str,
original_args: &[String],
) -> String
pub fn generate_rust_code( &self, base_expr: &str, original_args: &[String], ) -> String
Generate Rust code for this pattern
§Arguments
base_expr- The object/variable being operated onoriginal_args- Original arguments from Python call
Sourcepub fn yields_results(&self) -> bool
pub fn yields_results(&self) -> bool
Check if this pattern yields Result types in iteration
Trait Implementations§
Source§impl Clone for RustPattern
impl Clone for RustPattern
Source§fn clone(&self) -> RustPattern
fn clone(&self) -> RustPattern
Returns a duplicate 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 moreAuto Trait Implementations§
impl Freeze for RustPattern
impl RefUnwindSafe for RustPattern
impl Send for RustPattern
impl Sync for RustPattern
impl Unpin for RustPattern
impl UnwindSafe for RustPattern
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