4 ms·
It would most likely suffer from similar problems when interacting with the C and C++ APIs in the rest of Chrome though (e.g. what to do if you have a Rust Stri
by flohofwoe 4y ago
It would most likely suffer from similar problems when interacting with the C and C++ APIs in the rest of Chrome though (e.g. what to do if you have a Rust String, but the other side wants a const ref to a C++ std::string).
- imron 4y agoUse a CxxString: https://cxx.rs/binding/cxxstring.html https://cxx.rs/binding/cxxstring.html At some point there will need to be an allocation when crossing Rust -> C++ boundary because Rust strings are not null-terminated. The difference Rust makes is that unlike C++, it is always explicit when the allocation occurs.
- IshKebab 4y agoUnfortunately the restrictions mentioned on that page make it quite a pain to use in practice.