On 12-04-22 06:02 PM, Joe Groff wrote:

> It would definitely be more forward-thinking to use slices as the
> primary native mechanism for passing around strings and
> memory-contiguous sequences in general.

That is the current plan. I'm in the process of implementing it.

https://github.com/mozilla/rust/issues/2112

> Regions should help make
> data-sharing slices safe to use. Since C calls already require that
> arguments be copied to the FFI context, does making null-terminated
> copies of strings add that much additional overhead? Copying is pretty
> cheap on modern platforms.

Copying a pointer (as is required by the FFI) and copying a string are
different operations. The latter is what we're trying to avoid, and it's
costly, yes. Particularly when in inner loops, as C calls often are.

-Graydon
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to