use redis_module::{redis_module, Context, RedisError, RedisResult, RedisString}; fn hello_mul(_: &Context, args: Vec) -> RedisResult { if args.len() < 2 { return Err(RedisError::WrongArity); } let nums = args .into_iter() .skip(1) .map(|s| s.parse_integer()) .collect::, RedisError>>()?; let product = nums.iter().product(); let mut response = nums; response.push(product); Ok(response.into()) } ////////////////////////////////////////////////////// redis_module! { name: "hello", version: 1, allocator: (redis_module::alloc::RedisAlloc, redis_module::alloc::RedisAlloc), data_types: [], commands: [ ["hello.mul", hello_mul, "", 0, 0, 0], ], }