Trait Overload

Source
pub trait Overload {
    // Required methods
    fn get_returned_type(&self, params: &[AnyExpr]) -> Option<Type>;
    fn unroll(
        &self,
        params: Vec<AnyExpr>,
        context: &mut CompileContext,
        props: Properties,
    ) -> AnyExpr;
}
Expand description

Trait for function overloads

Required Methods§

Source

fn get_returned_type(&self, params: &[AnyExpr]) -> Option<Type>

Get the return type for the given parameters. Returns None if the overload cannot be called with these parameters.

Source

fn unroll( &self, params: Vec<AnyExpr>, context: &mut CompileContext, props: Properties, ) -> AnyExpr

Unroll the function for the given params. The resulting expression matches the type returned by get_returned_type.

Implementors§

Source§

impl<R, F> Overload for FunctionOverload<F, (), R, &CompileContext>
where R: GeoType + Into<AnyExpr> + 'static, F: Fn(&CompileContext, Properties) -> R,

Source§

impl<R, F> Overload for FunctionOverload<F, (), R, &mut CompileContext>
where R: GeoType + Into<AnyExpr> + 'static, F: Fn(&mut CompileContext, Properties) -> R,

Source§

impl<T0, R, F> Overload for FunctionOverload<F, (T0,), R, &CompileContext>
where T0: GeoType + 'static, R: GeoType + Into<AnyExpr> + 'static, F: Fn(T0, &CompileContext, Properties) -> R,

Source§

impl<T0, R, F> Overload for FunctionOverload<F, (T0,), R, &mut CompileContext>
where T0: GeoType + 'static, R: GeoType + Into<AnyExpr> + 'static, F: Fn(T0, &mut CompileContext, Properties) -> R,

Source§

impl<T0, T1, R, F> Overload for FunctionOverload<F, (T0, T1), R, &CompileContext>
where T0: GeoType + 'static, T1: GeoType + 'static, R: GeoType + Into<AnyExpr> + 'static, F: Fn(T0, T1, &CompileContext, Properties) -> R,

Source§

impl<T0, T1, R, F> Overload for FunctionOverload<F, (T0, T1), R, &mut CompileContext>
where T0: GeoType + 'static, T1: GeoType + 'static, R: GeoType + Into<AnyExpr> + 'static, F: Fn(T0, T1, &mut CompileContext, Properties) -> R,

Source§

impl<T0, T1, T2, R, F> Overload for FunctionOverload<F, (T0, T1, T2), R, &CompileContext>
where T0: GeoType + 'static, T1: GeoType + 'static, T2: GeoType + 'static, R: GeoType + Into<AnyExpr> + 'static, F: Fn(T0, T1, T2, &CompileContext, Properties) -> R,

Source§

impl<T0, T1, T2, R, F> Overload for FunctionOverload<F, (T0, T1, T2), R, &mut CompileContext>
where T0: GeoType + 'static, T1: GeoType + 'static, T2: GeoType + 'static, R: GeoType + Into<AnyExpr> + 'static, F: Fn(T0, T1, T2, &mut CompileContext, Properties) -> R,

Source§

impl<T0, T1, T2, T3, R, F> Overload for FunctionOverload<F, (T0, T1, T2, T3), R, &CompileContext>
where T0: GeoType + 'static, T1: GeoType + 'static, T2: GeoType + 'static, T3: GeoType + 'static, R: GeoType + Into<AnyExpr> + 'static, F: Fn(T0, T1, T2, T3, &CompileContext, Properties) -> R,

Source§

impl<T0, T1, T2, T3, R, F> Overload for FunctionOverload<F, (T0, T1, T2, T3), R, &mut CompileContext>
where T0: GeoType + 'static, T1: GeoType + 'static, T2: GeoType + 'static, T3: GeoType + 'static, R: GeoType + Into<AnyExpr> + 'static, F: Fn(T0, T1, T2, T3, &mut CompileContext, Properties) -> R,