Suppose I have a large codebase using j4rs, with calls to jvm::invoke_async. I don't want to audit every single call site to ensure the returned future is CompletableFuture. You should consider disallowing the use of plain Future with async methods. Instead, you could expose the wrapper you wrote (J4rsPolledFuture) and have callers use it as needed.
This change would cohere with Rust's culture of paying for what you need explicitly. For example, dynamic dispatch must be enabled with dyn. Costs are not hidden from the programmer.
Suppose I have a large codebase using j4rs, with calls to jvm::invoke_async. I don't want to audit every single call site to ensure the returned future is
CompletableFuture. You should consider disallowing the use of plainFuturewith async methods. Instead, you could expose the wrapper you wrote (J4rsPolledFuture) and have callers use it as needed.This change would cohere with Rust's culture of paying for what you need explicitly. For example, dynamic dispatch must be enabled with
dyn. Costs are not hidden from the programmer.