Page MenuHomePhabricator

[native] restructure functions to be exposed across FFI boundary
ClosedPublic

Authored by varun on Aug 23 2022, 10:44 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 13, 5:08 PM
Unknown Object (File)
Fri, Nov 29, 7:03 AM
Unknown Object (File)
Fri, Nov 29, 4:18 AM
Unknown Object (File)
Fri, Nov 29, 2:12 AM
Unknown Object (File)
Nov 22 2024, 10:19 AM
Unknown Object (File)
Nov 5 2024, 2:06 AM
Unknown Object (File)
Oct 26 2024, 12:28 PM
Unknown Object (File)
Oct 6 2024, 2:12 AM
Subscribers

Details

Summary

CXX doesn't have as much support for methods as I thought, so I'm changing the methods to normal functions that take an additional client param. We use a Box pointer because opaque Rust types can't be passed directly. I also removed all opaque Rust types from the return values of these functions.

Depends on D4935

Test Plan

cargo build, this is just a slight refactor even though it looks big

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tomek requested changes to this revision.Aug 24 2022, 3:08 AM

Could you explain a bit what do you mean by

CXX doesn't have as much support for methods as I thought

?
It seems like cxx supports methods https://cxx.rs/extern-rust.html#methods

This revision now requires changes to proceed.Aug 24 2022, 3:08 AM
In D4936#142927, @tomek wrote:

Could you explain a bit what do you mean by

CXX doesn't have as much support for methods as I thought

?
It seems like cxx supports methods https://cxx.rs/extern-rust.html#methods

Sorry, methods are supported. The issue is that it doesn't recognize the new() constructor in the impl block. I wasn't able to add this function to the ffi module

In D4936#143216, @varun wrote:
In D4936#142927, @tomek wrote:

Could you explain a bit what do you mean by

CXX doesn't have as much support for methods as I thought

?
It seems like cxx supports methods https://cxx.rs/extern-rust.html#methods

Sorry, methods are supported. The issue is that it doesn't recognize the new() constructor in the impl block. I wasn't able to add this function to the ffi module

Thanks for the explanation! It's surprising that cxx doesn't support that, but spending too much time on it doesn't make sense when we have a working solution.

This revision is now accepted and ready to land.Aug 25 2022, 1:37 AM