Document async FFI and error handling patterns in Rust AGENTS.md#6473
Document async FFI and error handling patterns in Rust AGENTS.md#6473
Conversation
Add guidance on how to declare async functions in extern "Rust" CXX bridge blocks (explicit lifetime + unsafe required), and how to handle errors across the FFI boundary (thiserror, std::io::Error, or cxx::KjError). Assisted-by: Claude
|
The documentation is accurate. The code examples in the PR match the real patterns in the codebase. Let me do a final check on one detail -- the The documentation is concise, accurate, and well-structured. All the technical claims check out against the actual codebase and the workerd-cxx fork. This is purely a documentation change to an AGENTS.md file, so there are no backward compatibility, security, or runtime behavior concerns. LGTM |
2ca54e2 to
2a282a7
Compare
I had trouble coaxing Claude to implement an async, Result-returning cxxbridged Rust function, because it doesn't know that our cxx-rs fork supports async interoperability, or KJ exceptions. I'm not sure where's best to put this, but this file seems reasonable.
Add guidance on how to declare async functions in extern "Rust" CXX bridge blocks (explicit lifetime + unsafe required), and how to handle errors across the FFI boundary (thiserror, std::io::Error, or cxx::KjError).
Assisted-by: Claude