Trait BinaryOperation

Source
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§

Source

fn operator(&self) -> &Self::OperatorType

Get the operator type.

Source

fn left(&self) -> &ExprType

Get the left operand.

Source

fn right(&self) -> &ExprType

Get the right operand.

Provided Methods§

Source

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.

Implementors§