You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
extern"Rust"{typeFoo;// Some opaque type managed by rustfncreate_foo() -> Box<Foo>;// C++ gets a reference to Foofndo_something_with_foo(foo:Box<Foo>) -> Result<i32>;// C++ gives back ownership of Foo to rust at a later time}
The above code compiles fine, but I'm not sure if it should. This is because the generated code looks like this:
The parameter signature doesn't make sense to me, because I would expect it to take foo by rvalue reference, that way I can call do_something_with_foo(std::move(boxed_foo)) and value gets moved into the function, and cleaned up by rust. As it stands now, I can never use this function, because foo can never be copied or created, so it can never be called. Is this expected behavior? If yes, then how would this be useful?
The text was updated successfully, but these errors were encountered:
Suppose that I create the following interface:
The above code compiles fine, but I'm not sure if it should. This is because the generated code looks like this:
The parameter signature doesn't make sense to me, because I would expect it to take foo by rvalue reference, that way I can call
do_something_with_foo(std::move(boxed_foo))
and value gets moved into the function, and cleaned up by rust. As it stands now, I can never use this function, because foo can never be copied or created, so it can never be called. Is this expected behavior? If yes, then how would this be useful?The text was updated successfully, but these errors were encountered: