pub trait BinaryOperation: Clone + Debug {
type OperatorType: PythonOperator;
// Required methods
fn operator(&self) -> &Self::OperatorType;
fn left(&self) -> &ExprType;
fn right(&self) -> &ExprType;
// Provided method
fn generate_rust_code(
&self,
ctx: CodeGenContext,
options: PythonOptions,
symbols: SymbolTableScopes,
) -> Result<TokenStream, Box<dyn Error>> { ... }
}
Expand description
Common trait for binary operations (binary ops, bool ops, comparisons).
Required Associated Types§
Required Methods§
Sourcefn operator(&self) -> &Self::OperatorType
fn operator(&self) -> &Self::OperatorType
Get the operator type.
Provided Methods§
Sourcefn generate_rust_code(
&self,
ctx: CodeGenContext,
options: PythonOptions,
symbols: SymbolTableScopes,
) -> Result<TokenStream, Box<dyn Error>>
fn generate_rust_code( &self, ctx: CodeGenContext, options: PythonOptions, symbols: SymbolTableScopes, ) -> Result<TokenStream, Box<dyn Error>>
Generate Rust code for this binary operation.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.