pub(crate) enum Shape {
Unary,
Binary,
Variadic,
}Expand description
The three scalar function arities the macro generates for.
Variants§
Implementations§
Source§impl Shape
impl Shape
Sourcepub(crate) fn modifiers(&self) -> &'static [(Modifier, ReturnTy)]
pub(crate) fn modifiers(&self) -> &'static [(Modifier, ReturnTy)]
The modifiers this arity accepts, with the return type of each generated method. A modifier absent from this table is rejected.
Sourcepub(crate) fn accepts(&self, modifier: Modifier) -> bool
pub(crate) fn accepts(&self, modifier: Modifier) -> bool
Whether this arity’s table lists modifier.
pub(crate) fn label(&self) -> &'static str
Sourcepub(crate) fn trait_path(&self) -> TokenStream
pub(crate) fn trait_path(&self) -> TokenStream
The trait the generated impl implements.
Sourcepub(crate) fn output_method(&self) -> (Ident, TokenStream)
pub(crate) fn output_method(&self) -> (Ident, TokenStream)
The name and sole parameter of the trait method that computes the output
SqlColumnType.
EagerVariadicFunc declares no output_sql_type. Its core method is named
output_type and takes the SQL column types directly, where the unary and
binary traits declare output_sql_type and keep output_type as a wrapper
over ReprColumnType.
Sourcepub(crate) fn nullability(&self, checks: &[TokenStream]) -> TokenStream
pub(crate) fn nullability(&self, checks: &[TokenStream]) -> TokenStream
The tail of the output-type method, which sets the nullability of the
output column type the caller computed.
The caller binds output, nullable, and propagates_nulls, and names the
input parameter as Shape::output_method spells it. checks are
per-position nullability checks over input_types. Unary receives a single
column type, so it has no position to check and ignores them.
The result is nullable when the function itself introduces nulls, when a parameter that rejects NULL is handed a nullable input, because the runtime conversion then rejects the NULL, or when the function propagates nulls and some input is nullable, because the optimizer short-circuits an all-NULL call.