Skip to main content

get_cast

Function get_cast 

Source
fn get_cast(
    ecx: &ExprContext<'_>,
    ccx: CastContext,
    from: &SqlScalarType,
    to: &SqlScalarType,
) -> Result<Box<dyn FnOnce(HirScalarExpr) -> HirScalarExpr>, CastError>
Expand description

Get casts directly between two SqlScalarTypes, with control over the allowed CastContext.

Returns Err when the cast is not supported: either no cast exists (CastError::InvalidCast) or the cast is disallowed (CastError::UnsupportedRangeElementType, e.g. range over float/uint).