macro_rules! generate_extracted_config {
($option_ty:ty, [$($processed:tt)*], ($option_name:path, $t:ty), $($tail:tt),*) => { ... };
($option_ty:ty, [$($processed:tt)*], ($option_name:path, $t:ty)) => { ... };
($option_ty:ty, [$($processed:tt)*], ($option_name:path, $t:ty, Default($v:expr)), $($tail:tt),*) => { ... };
($option_ty:ty, [$($processed:tt)*], ($option_name:path, $t:ty, Default($v:expr))) => { ... };
($option_ty:ty, [$($processed:tt)*], ($option_name:path, $t:ty, AllowMultiple), $($tail:tt),*) => { ... };
($option_ty:ty, [$($processed:tt)*], ($option_name:path, $t:ty, AllowMultiple)) => { ... };
($option_ty:ty, [$(($option_name:path, $t:ty, $v:expr, $allow_multiple:literal))+]) => { ... };
($option_ty:ty, $($h:tt),+) => { ... };
(@ifexpr false, $lhs:expr, $rhs:expr) => { ... };
(@ifexpr true, $lhs:expr, $rhs:expr) => { ... };
(@ifty false, $lhs:ty, $rhs:ty) => { ... };
(@ifty true, $lhs:ty, $rhs:ty) => { ... };
}Expand description
Generates a struct capable of taking a Vec of types commonly used to
represent WITH options into useful data types, such as strings.
Additionally, it is able to convert the useful data types back to the Vec
of options.
§Parameters
$option_ty: Accepts a struct representing a set ofWITHoptions, which must contain the fieldsnameandvalue.namemust be of type$option_tyName, e.g. if$option_tyisFooOption, thennamemust be of typeFooOptionName.$option_tyNamemust be an enum representingWITHoption keys.TryFromValue<value>must be implemented for the type you want to take the option to. Thesql::plan::with_optionmodule contains these implementations.
$option_namemust be an element of$option_tyName$tis the type you want to convert the option’s value to. If the option’s value is absent (i.e. the user only entered the option’s key), you can also define a default value.Default($v)is an optional parameter that sets the default value of the field to$v.$vmust be convertible to$tusing.into. This also converts the struct’s type fromOption<$t>to<$t>.AllowMultipleis an optional parameter that, when specified, allows the given option to appear multiple times in theWITHclause. This also converts the struct’s type from$ttoVec<$t>.