oneline_template/functions/int/
hex.rs

1use crate::function_executor::*;
2
3/// Function: `int:hex`
4/// 
5/// Input: `int`
6///
7/// Returns `string`
8pub struct Hex;
9
10impl FunctionExecutor for Hex {
11    fn schema(&self) -> FunctionSchema {
12        FunctionSchema::new("int:hex")
13    }
14
15    fn call(&self, value: Value, _arguments: &[Value]) -> Result<Value, FunctionError> {
16        let value = value.as_int()?;
17        let value = format!("{:x}", value);
18        let value = Value::String(value);
19        return Ok(value);
20    }
21}