Trait arithmetic_typing::arith::TypeArithmetic
source · pub trait TypeArithmetic<Prim: PrimitiveType> {
// Required methods
fn process_unary_op(
&self,
substitutions: &mut Substitutions<Prim>,
context: &UnaryOpContext<Prim>,
errors: OpErrors<'_, Prim>,
) -> Type<Prim>;
fn process_binary_op(
&self,
substitutions: &mut Substitutions<Prim>,
context: &BinaryOpContext<Prim>,
errors: OpErrors<'_, Prim>,
) -> Type<Prim>;
}
Expand description
Arithmetic allowing to customize primitive types and how unary and binary operations are handled during type inference.
§Examples
See crate examples for examples how define custom arithmetics.
Required Methods§
sourcefn process_unary_op(
&self,
substitutions: &mut Substitutions<Prim>,
context: &UnaryOpContext<Prim>,
errors: OpErrors<'_, Prim>,
) -> Type<Prim>
fn process_unary_op( &self, substitutions: &mut Substitutions<Prim>, context: &UnaryOpContext<Prim>, errors: OpErrors<'_, Prim>, ) -> Type<Prim>
Handles a unary operation.
sourcefn process_binary_op(
&self,
substitutions: &mut Substitutions<Prim>,
context: &BinaryOpContext<Prim>,
errors: OpErrors<'_, Prim>,
) -> Type<Prim>
fn process_binary_op( &self, substitutions: &mut Substitutions<Prim>, context: &BinaryOpContext<Prim>, errors: OpErrors<'_, Prim>, ) -> Type<Prim>
Handles a binary operation.