Skip to main content

Module signature

Module signature 

Source
Expand description

Analysis of a #[sqlfunc]-annotated function’s signature.

These helpers read syn types and answer what a generated trait impl needs to know about the function it wraps: its associated types once generic parameters are erased, which input positions reject NULL, and the output type a polymorphic signature implies. Nothing here reads the attribute’s modifiers or the arity tables, so it stays a leaf of the crate.

EnumsΒ§

GenericUsage πŸ”’
How a generic type parameter T appears in a type.

FunctionsΒ§

camel_case πŸ”’
Convert an identifier to a camel-cased identifier.
classify_generic_usage πŸ”’
Classifies how a generic type parameter appears in a type.
container_idents_match πŸ”’
Compare two container type paths by their ident segments (ignoring lifetimes and generic arguments). Two containers are β€œsame” if their path idents match.
derive_output_type_for_generic πŸ”’
Derives an output_type_expr for a single generic parameter, which appears in the output type as output_usage.
derive_output_type_for_generics πŸ”’
Derives an output_type_expr TokenStream from the structural relationship between input types and the output type, based on where generic parameters appear.
element_type_expr πŸ”’
Generates a token stream that extracts the T-level SQL type from an input access expression, based on how T is used in that input.
elide_lifetimes πŸ”’
Replaces all lifetime parameters in a syn::TypePath with '_.
elide_lifetimes_in_type πŸ”’
Recursively replaces all lifetime parameters in a syn::Type with '_.
erase_all_generic_params πŸ”’
Erases all generic type parameters from a type, replacing each with Datum<'a>.
erase_generic_param πŸ”’
Replaces occurrences of a generic type parameter with Datum<'a> in a type.
find_generic_type_params πŸ”’
Extracts generic type parameters from a function signature. Returns an empty Vec if there are no type parameters.
has_receiver πŸ”’
Checks if the function takes a self receiver.
is_nullable_type πŸ”’
Checks if a parameter type accepts NULL.
is_option_wrapped πŸ”’
Returns whether the outermost wrapper of a type is Option.
is_variadic_arg πŸ”’
Checks whether a parameter’s type is Variadic<...> or OptionalArg<...>, which makes the function variadic regardless of parameter count.
is_variadic_type πŸ”’
Checks if a type is Variadic<T>.
last_is_arena πŸ”’
Checks if the last parameter of the function is a &RowArena.
non_nullable_position_checks πŸ”’
Generates per-position nullability checks for non-nullable parameters.
output_type πŸ”’
Determine the output type for a function. Returns an error if the function does not return a value.
patch_lifetimes πŸ”’
Recursively patches lifetimes in a type, adding 'a to references without a lifetime and recursing into generic arguments and tuples.
sql_args πŸ”’
The parameters that carry SQL arguments, which excludes a &self receiver and a trailing &RowArena.
type_contains_ident πŸ”’
Returns whether a type syntactically contains an identifier.
variadic_element_is_nullable πŸ”’
For a Variadic<T> type, checks if T accepts NULL.