[][src]Module ffi_support::string

Functions

destroy_c_string

Free the memory of a string created by [rust_string_to_c] on the rust heap. If c_string is null, this is a no-op.

opt_rust_str_from_cDeprecated

Same as rust_string_from_c, but returns None if c_string is null instead of asserting.

opt_rust_string_from_cDeprecated

Same as rust_string_from_c, but returns None if c_string is null instead of asserting.

opt_rust_string_to_c

Variant of [rust_string_to_c] which takes an Option, and returns null for None.

rust_str_from_cDeprecated

Convert a null-terminated C string to a rust str. This does not take ownership of the string, and you should be careful about the lifetime of the resulting string. Note that strings containing invalid UTF-8 are replaced with the empty string (for many cases, you will want to use [rust_string_from_c] instead, which will do a lossy conversion).

rust_string_from_cDeprecated

Convert a null-terminated C into an owned rust string, replacing invalid UTF-8 with the unicode replacement character.

rust_string_to_c

Convert a rust string into a NUL-terminated utf-8 string suitable for passing to C, or to things ABI-compatible with C.