Skip to main content

Module macros

Module macros 

Source
Expand description

The ff_function! declarative macro for typed FCALL wrappers.

Generates an async function that:

  1. Builds KEYS and ARGV vectors from the provided expressions
  2. Calls conn.fcall::<Value>(fn_name, &keys, &argv)
  3. Parses the result via FromFcallResult

§Example

ff_function! {
    /// Complete an active execution.
    pub ff_complete_execution(args: CompleteExecutionArgs) -> CompleteExecutionResult {
        keys(ctx: &ExecKeyContext) {
            ctx.core(),
            ctx.attempt_hash(args.attempt_index),
            ctx.lease_current(),
        }
        argv {
            args.execution_id.to_string(),
            args.lease_id.to_string(),
        }
    }
}