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