I’m a bit surprised that it’s supposed to be this bad, given that Mozilla uses it in Firefox and there’s the whole CXX toolchain.
Granted, Rust was not designed from the ground up to be C+±like, but I’m really not sure that’s a good idea anyways.
Wanting bug-free programs without wanting functional programming paradigms is a bit like:
Of course, if we’re able to migrate a lot of old C++ codebases to a slightly better standard relatively easily, then that is still something…
Probably seems like a little thing but I found it quite annoying in practice, and there are other things like not being able to combine serde-derive and cxx FFI on the same struct.
Sounds like you’ll always have to do this little dance for any string you want to pass through, so I can definitely see how that could become quite annoying.
For not being able to combine serde-derive and cxx FFI on the same struct, there’s a simple trick that can be used for many such situations:
I’m a bit surprised that it’s supposed to be this bad, given that Mozilla uses it in Firefox and there’s the whole CXX toolchain.
Granted, Rust was not designed from the ground up to be C+±like, but I’m really not sure that’s a good idea anyways.
Wanting bug-free programs without wanting functional programming paradigms is a bit like:
Of course, if we’re able to migrate a lot of old C++ codebases to a slightly better standard relatively easily, then that is still something…
The biggest issue is move constructors. Explanation here: https://cxx.rs/binding/cxxstring.html#restrictions
Probably seems like a little thing but I found it quite annoying in practice, and there are other things like not being able to combine serde-derive and cxx FFI on the same struct.
Sounds like you’ll always have to do this little dance for any string you want to pass through, so I can definitely see how that could become quite annoying.
For not being able to combine serde-derive and cxx FFI on the same struct, there’s a simple trick that can be used for many such situations:
struct CxxThingamabob { ... } #[derive(Serialize, Deserialize)] #[serde(transparent)] struct SerializableCxxThingamabob(CxxThingamabob);
That just moves the Serde implementation to a different struct, so that you can choose which one you want by either wrapping or unwrapping it.