-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move utils bridged methods into their own ffi module
Discovered that we can use `Pin<&mut ...>` to allow mutation of Rust types defined in another cxx bridge module, based on: - https://cxx.rs/extern-c++.html#opaque-c-types > Unlike extern Rust types and shared types, an extern C++ type is not > permitted to be passed by plain mutable reference &mut MyType across the > FFI bridge. For mutation support, the bridge is required to use Pin<&mut > MyType>. This is to safeguard against things like mem::swap-ing the > contents of two mutable references, given that Rust doesn't have > information about the size of the underlying object and couldn't invoke > an appropriate C++ move constructor anyway. - dtolnay/cxx#942
- Loading branch information
1 parent
73db155
commit 4b8034c
Showing
4 changed files
with
34 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters