Core trait for all functions - just implement this for any function
| 107 | |
| 108 | /// Core trait for all functions - just implement this for any function |
| 109 | pub 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 | } |
nothing calls this directly
no outgoing calls
no test coverage detected