From fbb69329343c9985c26181e6297e6556c46d381d Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Thu, 29 Jun 2023 10:23:14 -0600 Subject: refactor(ops): op2 support for generics (#19636) Implementation of generics for `#[op2]`, along with some refactoring to improve the ergonomics of ops with generics parameters: - The ops have generics on the struct rather than the associated methods, which allows us to trait-ify ops (impossible when they are on the methods) - The decl() method can become a trait-associated const field which unlocks future optimizations Callers of ops need to switch from: `op_net_connect_tcp::call::(conn_state, ip_addr)` to `op_net_connect_tcp::::call(conn_state, ip_addr)`. --- core/runtime/ops.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'core/runtime') diff --git a/core/runtime/ops.rs b/core/runtime/ops.rs index 1c871cda0..9e37977c8 100644 --- a/core/runtime/ops.rs +++ b/core/runtime/ops.rs @@ -218,7 +218,8 @@ mod tests { op_test_result_void_ok, op_test_result_void_err, op_test_result_primitive_ok, - op_test_result_primitive_err + op_test_result_primitive_err, + op_test_generics, ] ); @@ -404,4 +405,8 @@ mod tests { )?; Ok(()) } + + // We don't actually test this one -- we just want it to compile + #[op2(core, fast)] + pub fn op_test_generics() {} } -- cgit v1.2.3