pub(crate) struct FunctionAttr {Show 14 fields
pub(crate) name: String,
pub(crate) args: Vec<String>,
pub(crate) ret: String,
pub(crate) is_table_function: bool,
pub(crate) append_only: bool,
pub(crate) batch_fn: Option<String>,
pub(crate) state: Option<String>,
pub(crate) init_state: Option<String>,
pub(crate) prebuild: Option<String>,
pub(crate) type_infer: Option<String>,
pub(crate) generic: Option<String>,
pub(crate) volatile: bool,
pub(crate) deprecated: bool,
pub(crate) rewritten: bool,
}
Fields§
§name: String
Function name
args: Vec<String>
Input argument types
ret: String
Return type
is_table_function: bool
Whether it is a table function
append_only: bool
Whether it is an append-only aggregate function
batch_fn: Option<String>
Optional function for batch evaluation.
state: Option<String>
State type for aggregate function. If not specified, it will be the same as return type.
init_state: Option<String>
Initial state value for aggregate function. If not specified, it will be NULL.
prebuild: Option<String>
Prebuild function for arguments. This could be any Rust expression.
type_infer: Option<String>
Type inference function.
generic: Option<String>
Generic type.
volatile: bool
Whether the function is volatile.
deprecated: bool
If true, the function is unavailable on the frontend.
rewritten: bool
If true, the function is not implemented on the backend, but its signature is defined.
Implementations§
source§impl FunctionAttr
impl FunctionAttr
sourcefn generate_type_infer_fn(&self) -> Result<TokenStream2>
fn generate_type_infer_fn(&self) -> Result<TokenStream2>
Generate the type infer function: fn(&[DataType]) -> Result<DataType>
sourcepub fn generate_function_descriptor(
&self,
user_fn: &UserFunctionAttr,
build_fn: bool,
) -> Result<TokenStream2>
pub fn generate_function_descriptor( &self, user_fn: &UserFunctionAttr, build_fn: bool, ) -> Result<TokenStream2>
Generate a descriptor (FuncSign
) of the scalar or table function.
The types of arguments and return value should not contain wildcard.
§Arguments
build_fn
: whether the user provided a function is a build function.
(from the #[build_function]
macro)
sourcefn generate_build_scalar_function(
&self,
user_fn: &UserFunctionAttr,
optimize_const: bool,
) -> Result<TokenStream2>
fn generate_build_scalar_function( &self, user_fn: &UserFunctionAttr, optimize_const: bool, ) -> Result<TokenStream2>
Generate a build function for the scalar function.
If optimize_const
is true, the function will be optimized for constant arguments,
and fallback to the general version if any argument is not constant.
sourcepub fn generate_aggregate_descriptor(
&self,
user_fn: &AggregateFnOrImpl,
build_fn: bool,
) -> Result<TokenStream2>
pub fn generate_aggregate_descriptor( &self, user_fn: &AggregateFnOrImpl, build_fn: bool, ) -> Result<TokenStream2>
Generate a descriptor of the aggregate function.
The types of arguments and return value should not contain wildcard.
user_fn
could be either fn
or impl
.
If build_fn
is true, user_fn
must be a fn
that builds the aggregate function.
sourcefn generate_agg_build_fn(
&self,
user_fn: &AggregateFnOrImpl,
) -> Result<TokenStream2>
fn generate_agg_build_fn( &self, user_fn: &AggregateFnOrImpl, ) -> Result<TokenStream2>
Generate build function for aggregate function.
sourcefn generate_table_function_descriptor(
&self,
user_fn: &UserFunctionAttr,
build_fn: bool,
) -> Result<TokenStream2>
fn generate_table_function_descriptor( &self, user_fn: &UserFunctionAttr, build_fn: bool, ) -> Result<TokenStream2>
Generate a descriptor of the table function.
The types of arguments and return value should not contain wildcard.
fn generate_build_table_function( &self, user_fn: &UserFunctionAttr, ) -> Result<TokenStream2>
source§impl FunctionAttr
impl FunctionAttr
sourcepub(crate) fn ident_name(&self) -> String
pub(crate) fn ident_name(&self) -> String
Return a unique name that can be used as an identifier.
Trait Implementations§
source§impl Clone for FunctionAttr
impl Clone for FunctionAttr
source§fn clone(&self) -> FunctionAttr
fn clone(&self) -> FunctionAttr
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for FunctionAttr
impl Debug for FunctionAttr
source§impl Default for FunctionAttr
impl Default for FunctionAttr
source§fn default() -> FunctionAttr
fn default() -> FunctionAttr
source§impl Parse for FunctionAttr
impl Parse for FunctionAttr
source§fn parse(input: ParseStream<'_>) -> Result<Self>
fn parse(input: ParseStream<'_>) -> Result<Self>
Parse the attribute of the function macro.
Auto Trait Implementations§
impl Freeze for FunctionAttr
impl RefUnwindSafe for FunctionAttr
impl Send for FunctionAttr
impl Sync for FunctionAttr
impl Unpin for FunctionAttr
impl UnwindSafe for FunctionAttr
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more