MCPcopy Index your code
hub / github.com/GraphLite-AI/GraphLite / Function

Interface Function

graphlite/src/functions/function_trait.rs:109–142  ·  view source on GitHub ↗

Core trait for all functions - just implement this for any function

Source from the content-addressed store, hash-verified

107
108/// Core trait for all functions - just implement this for any function
109pub trait Function: Send + Sync + std::fmt::Debug {
110 /// Get the name of the function
111 #[allow(dead_code)] // ROADMAP v0.5.0 - Function metadata for introspection (see ROADMAP.md §8)
112 fn name(&self) -> &str;
113
114 /// Get the function description
115 #[allow(dead_code)] // ROADMAP v0.5.0 - Function metadata for introspection (see ROADMAP.md §8)
116 fn description(&self) -> &str;
117
118 /// Get the expected number of arguments
119 #[allow(dead_code)] // ROADMAP v0.5.0 - Function metadata for introspection (see ROADMAP.md §8)
120 fn argument_count(&self) -> usize;
121
122 /// Execute the function with the given context
123 fn execute(&self, context: &FunctionContext) -> FunctionResult<Value>;
124
125 /// Get the return type of the function
126 #[allow(dead_code)] // ROADMAP v0.5.0 - Function metadata for introspection (see ROADMAP.md §8)
127 fn return_type(&self) -> &str;
128
129 /// Check if this function requires graph context to execute
130 /// Most functions that work with variables, properties, or graph data require context.
131 /// Pure scalar functions (math, string manipulation, timezone) do not.
132 fn graph_context_required(&self) -> bool {
133 true // Default to requiring context for safety
134 }
135
136 /// Check if this function accepts a variable number of arguments
137 /// Returns true for functions like ALL_DIFFERENT that can take any number of args
138 #[allow(dead_code)] // ROADMAP v0.5.0 - Function metadata for introspection (see ROADMAP.md §8)
139 fn is_variadic(&self) -> bool {
140 false // Default to fixed argument count
141 }
142}

Callers

nothing calls this directly

Implementers 10

string_functions.rsgraphlite/src/functions/string_functio
graph_functions.rsgraphlite/src/functions/graph_function
aggregate_functions.rsgraphlite/src/functions/aggregate_func
list_functions.rsgraphlite/src/functions/list_functions
temporal_functions.rsgraphlite/src/functions/temporal_funct
null_functions.rsgraphlite/src/functions/null_functions
timezone_functions.rsgraphlite/src/functions/timezone_funct
mathematical_functions.rsgraphlite/src/functions/mathematical_f
special_functions.rsgraphlite/src/functions/special_functi
numeric_functions.rsgraphlite/src/functions/numeric_functi

Calls

no outgoing calls

Tested by

no test coverage detected