MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / execute

Method execute

graphlite/src/functions/mathematical_functions.rs:58–69  ·  view source on GitHub ↗
(&self, context: &FunctionContext)

Source from the content-addressed store, hash-verified

56 }
57
58 fn execute(&self, context: &FunctionContext) -> FunctionResult<Value> {
59 context.validate_argument_count(1)?;
60
61 let arg = context.get_argument(0)?;
62 let number = arg
63 .as_number()
64 .ok_or_else(|| FunctionError::InvalidArgumentType {
65 message: format!("ABS requires a numeric argument, got {}", arg.type_name()),
66 })?;
67
68 Ok(Value::Number(number.abs()))
69 }
70}
71
72// ==============================================================================

Callers 1

test_pi_functionFunction · 0.45

Calls 3

get_argumentMethod · 0.80
as_numberMethod · 0.80

Tested by 1

test_pi_functionFunction · 0.36