Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
You have to implement it for both. In the standard library, this is done using macros: https://github.com/rust-lang/rust/blob/master/library/core/src/internal_macros.rs. A kind soul has extracted those macros into a separate crate you can use in your own code: https://crates.io/crates/forward_ref
It's easy to modify the macro to go the other way (you implement for the reference, derive impl for raw type). I did this when implementing a feature for wasm-bindgen, you can find the macros I wrote at the top of the file here: https://github.com/rustwasm/wasm-bindgen/blob/master/crates/js-sys/src/lib.rs