pub struct FunctionDefinition {
pub name: &'static str,
pub category: Option<&'static str>,
pub description: &'static str,
pub arguments: fn() -> Vec<FunctionArgument>,
pub handler: FunctionHandler,
}
Expand description
Holds the definition of a builtin callable function
Fields§
§name: &'static str
Function call name
category: Option<&'static str>
Function category
description: &'static str
Function short description
arguments: fn() -> Vec<FunctionArgument>
Vector of arguments the function supports
handler: FunctionHandler
Handler function
Implementations§
Source§impl FunctionDefinition
impl FunctionDefinition
Sourcepub fn description(&self) -> &str
pub fn description(&self) -> &str
Return the function’s description
Sourcepub fn args(&self) -> Vec<FunctionArgument>
pub fn args(&self) -> Vec<FunctionArgument>
Return the function’s arguments
Sourcepub fn collect(
&self,
args: &[Value],
) -> Result<FunctionArgumentCollection, ParserError>
pub fn collect( &self, args: &[Value], ) -> Result<FunctionArgumentCollection, ParserError>
Validate function arguments, and return the collected arguments
§Arguments
args
- Function arguments
Sourcepub fn call(
&self,
state: &mut ParserState,
args: &[Value],
) -> Result<Value, ParserError>
pub fn call( &self, state: &mut ParserState, args: &[Value], ) -> Result<Value, ParserError>
§Arguments
args
- Function arguments
Trait Implementations§
Source§impl Clone for FunctionDefinition
impl Clone for FunctionDefinition
Source§fn clone(&self) -> FunctionDefinition
fn clone(&self) -> FunctionDefinition
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for FunctionDefinition
impl RefUnwindSafe for FunctionDefinition
impl Send for FunctionDefinition
impl Sync for FunctionDefinition
impl Unpin for FunctionDefinition
impl UnwindSafe for FunctionDefinition
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
Mutably borrows from an owned value. Read more