Struct sql::plan::typeconv::CastTemplate [−][src]
struct CastTemplate(Box<dyn Fn(&ExprContext<'_>, CastContext, &ScalarType, &ScalarType) -> Option<Box<dyn FnOnce(HirScalarExpr) -> HirScalarExpr>> + Send + Sync>);
Expand description
A cast template is a function that produces a Cast
given a concrete input
and output type. A template can return None
to indicate that it is
incapable of producing a cast for the specified types.
Cast templates are used to share code for similar casts, where the input or output type is of one “category” of type. For example, a single cast template handles converting from strings to any list type. Without cast templates, we’d have to enumerate every possible list -> list conversion, which is impractical.
Tuple Fields
0: Box<dyn Fn(&ExprContext<'_>, CastContext, &ScalarType, &ScalarType) -> Option<Box<dyn FnOnce(HirScalarExpr) -> HirScalarExpr>> + Send + Sync>
Implementations
fn new<T, C>(t: T) -> CastTemplate where
T: Fn(&ExprContext<'_>, CastContext, &ScalarType, &ScalarType) -> Option<C> + Send + Sync + 'static,
C: FnOnce(HirScalarExpr) -> HirScalarExpr + 'static,
Trait Implementations
Performs the conversion.
Auto Trait Implementations
impl !RefUnwindSafe for CastTemplate
impl Send for CastTemplate
impl Sync for CastTemplate
impl Unpin for CastTemplate
impl !UnwindSafe for CastTemplate
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more