generate_nodejs_binary_binding!() { /* proc-macro */ }Expand description
Generate Node.js (NAPI) binding for a binary mathematical function
§Arguments
name- The function name (e.g.,pow)
§Examples
ⓘ
generate_nodejs_binary_binding!(pow);Generates:
ⓘ
#[napi]
pub fn pow(x: ExpressionOrNumber, y: ExpressionOrNumber) -> JsExpression {
JsExpression {
inner: Expression::function("pow", vec![x.0, y.0]),
}
}This accepts both Expression objects and numbers: pow(x, 2) or pow(2, 3)