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.
The wasm-bindgen library contains a component called web-sys.
Another example of using AsRef is the http-types library, which uses AsRef and AsMut to convert various types.
std::convert::AsRef . As you can see, AsRef is grouped under the convert module. if you look at the documentation, you will see that traits related to type conversions are defined in this module. For example, the familiar "From/To", "TryFrom/TryTo" and "AsRef/AsMut" also appear in pairs here, indicating that the feature is releated to type conversions. Based on the naming rules in the Rust API Guidelines , wen can infer that methods starting with as_ represent conversions from borrow -> borrow, i.e, reference -> reference , and are overhead-free. And such conversions do not fail.
Related posts
- Looking to create a backend service for a website in Rust and I’m wondering on how to best do it
- I'm trying to compile my rust code to wasm but wasm_bindgen says the trait bound `(Vec<i32>, Vec<i32>): IntoWasmAbi` is not satisfied.
- What do you think about NAPI (native bindings) vs. WebAssembly?
- Client side auth solutions?
- State of debugging in Rust -> Wasm