bare::ffi::wide
本页内容
API 参考只有英文版,由标准库源代码中的英文文档注释生成。
NUL-terminated wchar_t strings: UTF-16 on Windows
(the W APIs), one unit per char (UTF-32) elsewhere.
WideCStr and WideCString keep their units, NUL included, in one
GC buffer the value holds, so as_ptr holds as CStr::as_ptr does.
WideCStr::from_ptr copies.
Structs
WideCStrSource
pub struct WideCStrA NUL-terminated wchar_t string.
The wide C string at
p, copied up to its NUL;nonefor a null pointer.Safety:
pmust be null or point at a live NUL-terminatedwchar_tstring.A pointer to the first unit, for C; valid while
selfis alive.The units without the NUL.
The units with the trailing NUL.
Sourcepub fn to_str(§self) throws (Utf16Error) -> str The units before the NUL as a
str; throws at an unpaired surrogate (elsewhere than Windows: a unit that is no char).to_strwith each bad unit replaced by U+FFFD.Units before the NUL.
WideCStringSource
pub struct WideCStringAn owned NUL-terminated wchar_t string.
saswchar_tunits and a NUL; throws ifshas a NUL of its own (positionis its unit index).The borrowed wide C string (with its NUL), valid while
selfis alive.A pointer to the first unit, for C; valid while
selfis alive.The units without the NUL.
The string back;
newtook astr, so this never fails.Units before the NUL.