Replies: 2 comments 1 reply
-
The very short answer is that "arbitrary" string conversion or editing is out of scope, as the library is primarily concerned with creating bindings. Although some strings types are supported, e.g., nul-terminated ASCII strings being a C-native concept (and we probably could extend that to UTF-8 slices), modifying them from another language is another caliber. Two basic issues:
I'd recommend to convert the string to UTF-8 in C#, pass that to Rust, and return an entirely different string back to C# (with the implication that each language will have to handle its own allocation). Even better though might be trying to avoid the situation entirely due to the aforementioned allocation allocation / change-signalling issues. |
Beta Was this translation helpful? Give feedback.
-
Yes, you will have to. Likewise, in your As a general rule
|
Beta Was this translation helpful? Give feedback.
-
I am new to rust ,c# string encoding is unicode and rust is uft-8. but I don't know how to handle them.
I want to modify string in rust side, and read it in c#
rust code
c# code
Thanks for advice~
Beta Was this translation helpful? Give feedback.
All reactions