NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io
crates.io, #857 most downloaded on crates.io
A wide string Rust library for converting to and from wide strings, such as those often used in Windows API or other FFI libaries. Both `u16` and `u32` string types are provided, including support for UTF-16 and UTF-32, malformed encoding, C-style strings, etc.
Latest stable
1.2.1
Last release 1 years ago
09 Oct 2025
Release timing varies
gaps range from 1 weeks to 1.8 years
Most releases are documented
notes for 14 of 16 stable releases
1 version withdrawn
withdrawn after publishing
11 years old
18 releases · first in 2016
Drag across the ruler to compare, or tap a release to open it.
Git repository URL has changed due to GitHub user name change. Old URL is redirected.
trim_end character boundary panic when processing 4-byte characters. By @syrflover.U16String::insert_char which always panicked. Fixes #46.WideCString type alias.unused_import lint on wide* macros.Utf32String and Utf32Str. You can load them from gdb/widestring.py.Minor restructing of included license file locations to be more consistent with crates ecosystem.
windows-sys for documentation tests instead of legacy winapi crate. Fixes #40.Utf16String::truncate when new_len greater than string length. Fixes #39.core library structures.Your coding agent can read these notes before it upgrades. Set up the MCP server →
Utf32String::into_char_vec and missing conversion to Vec<char> for Utf32String . Fixes #37 .
Utf32String::into_char_vec and missing conversion to Vec<char> for Utf32String. Fixes #37.include_utf16str! macro to include UTF-16 file at compile-time as Utf16Str. By @daxpedda.U16String::pop_char panics with surrogate string. Fixes #38.Correctly check for and error on nul values in C-string macros u16cstr! , u32cstr! , and widecstr! . Fixes #28 .
u16cstr!, u32cstr!, and widecstr!. Fixes #28.Reduce collision potential for macros. By @OpenByteDev .
Breaking Change Minimum supported Rust version is now 1.58.
#[must_use] attributes to many crate functions, as appropriate.unsafe qualifiers from as_mut_ptr and as_mut_ptr_range to match standard library. By @yescallop.new function that creates and empty string to U16CString and U32CString to match other string types.From implementations for conversion to OsString.Also see the changes in 1.0.0-beta.1 if upgrading from 0.5.1 or earlier.
Breaking Change Minimum supported Rust version is now 1.56.
U16String and U32String have been renamed and replaced by functions with different semantics:
pop is now pop_charremove is now remove_charinsert is now insert_chariter::Utf16Chars renamed to CharsUtf16 and moved to ustr and ucstriter::Utf32Chars renamed to CharsUtf32 and moved to ustr and ucstriter::CharsLossy split and renamed to CharsLossyUtf16 and CharsLossyUtf32 and moved to ustr and ucstriter::Utf16CharIndices renamed to CharIndicesUtf16 and moved to ustr and ucstriter::Utf16CharIndicesLossy renamed to CharIndicesLossyUtf16 and moved to ustr and ucstrerror::FromUtf16Error and error::FromUtf32Error has been renamed to Utf16Error and Utf32Error respectively and expanded with more details about the error.U16Str and U32Str are now const:
from_sliceas_sliceas_ptrlenis_emptyU16CStr and U32CStr are now const:
from_slice_uncheckedas_slice_with_nulas_ptrlenis_emptyU16String and U32String are now const:
newUtf16StrUtf32StrUtf16StringUtf32Stringconst wide string slices:
u16str!u16cstr!u32str!u32cstr!widestr!widecstr!utf16str!utf32str!NUL_TERMINATOR associated constant to U16CStr, U32CStr, U16CString, and U32CString.DoubleEndedIterator and ExactSizeIterator implementations to a number of iterator types.encode_utf8encode_utf16encode_utf32repeat on U16Str, U32Str, U16CStr, and U32CStrshrink_to on U16String and U32Stringretain on U16String and U32Stringdrain on U16String and U32Stringreplace_range on U16String and U32Stringget, get_mut, get_unchecked, and get_unchecked_mut on U16CStr and U32CStrsplit_at and split_at_mut on U16CStr and U32CStrU16Str instead of UStr<u16>).
UCharUStrUCStrUStringUCStringIndexMut<RangeFull> trait implementation of U16CString and U32CString. Use the unsafe get_mut method instead, which also supports more ranges.U16Str::char_indices and U16CStr::char_indices is now over (usize, Result<char, DecodeUtf16Error>) tuples instead of the reverse order, to better match standard library string iterators. The same is true of U16Str::char_indices_lossy and U16CStr::char_indices_lossy. This matches what was stated in original documentation.U32Str::to_string and U32CStr::to_string now only allocate once instead of twice.Fixed a regression in 0.5.0 where zero-length vectors and strings were incorrectly causing panics in UCString::from_vec and UCString::from_str . Fixes
UCString::from_vec and UCString::from_str. Fixes #22.ustr::to_string & ustr::to_string_lossy to remove possibly unsafe behaviour.Breaking Change Renamed a number of types and functions to increase consistency and clarity. This also meant renaming errors to more clearly convey er…
MissingNulError => error::MissingNulTerminatorFromUtf32Error => error::FromUtf32ErrorNulError => error::ContainsNulUCStr::from_ptr_with_nul => from_ptr_uncheckedUCStr::from_slice_with_nul => from_slice_truncateUCStr::from_slice_with_nul_unchecked => from_slice_uncheckedU32CStr::from_char_ptr_with_nul => from_char_ptr_uncheckedU32CStr::from_char_slice_with_nul => from_char_slice_truncateU32CStr::from_char_slice_with_nul_unchecked => from_char_slice_uncheckedUCString::new => from_vecUCString::from_vec_with_nul => from_vec_truncateUCString::from_ustr_with_nul => from_ustr_truncateUCString::from_ptr_with_nul => from_ptr_truncateUCString::from_str_with_nul => from_str_truncateUCString::from_os_str_with_nul => from_os_str_truncateU32CString::from_chars_with_nul => from_chars_truncateU32CString::from_char_ptr_with_nul => from_char_ptr_truncateerror module instead.Debug implementations. No more debugging lists of raw integer values.decode_utf16, decode_utf16_lossy, decode_utf32, and decode_utf32_lossy and associated iterators. Note that decode_utf16 is an alias of core::char::decode_utf16, but provided for consistency.display method to to both UStr and UCStr to display strings in formatting without heap allocations, similar to Path::display. Fixes #20.Write trait. Fixes #19.UStr::from_ptr_mutUStr::from_slice_mutUStr::as_mut_sliceUStr::as_mut_ptrUStr::as_ptr_rangeUStr::as_mut_ptr_rangeUStr::getUStr::get_mutUStr::get_uncheckedUStr::get_unchecked_mutUStr::split_atUStr::split_at_mutUStr::charsUStr::chars_lossyU16Str::char_indicesU16Str::char_indices_lossyU32Str::from_char_ptr_mutU32Str::from_char_slice_mutUCStr::from_ptrUCStr::from_ptr_truncateUCStr::from_sliceUCStr::as_ustrUCStr::from_ptr_str_mutUCStr::from_ptr_mutUCStr::from_ptr_truncate_mutUCStr::from_ptr_unchecked_mutUCStr::from_slice_mutUCStr::from_slice_truncate_mutUCStr::from_slice_unchecked_mutUCStr::as_mut_sliceUCStr::as_mut_ptrUCStr::as_ustr_with_nulUCStr::as_mut_ustrUCStr::as_ptr_rangeUCStr::as_mut_ptr_rangeUCStr::charsUCStr::chars_lossyU16CStr::char_indicesU16CStr::char_indices_lossyU32CStr::from_char_ptr_str_mutU32CStr::from_char_ptr_mutU32CStr::from_char_ptr_truncate_mutU32CStr::from_char_ptr_unchecked_mutU32CStr::from_char_slice_mutU32CStr::from_char_slice_truncate_mutU32CStr::from_char_slice_unchecked_mutU32CStr::from_char_ptrU32CStr::from_char_ptr_truncateU32CStr::from_char_sliceUString::as_vecUString::as_mut_vecUString::push_charUString::truncateUString::popUString::removeUString::insertUString::insert_ustrUString::split_offUCString::as_mut_ucstrUCString::into_ustringUCString::into_ustring_with_nulU32CString::from_char_ptr_strUCString::from_vec_with_nul_unchecked. Use from_vec_unchecked instead.UCString::from_ustr_with_nul_unchecked. Use from_ustr_unchecked instead.UCString::from_ptr_with_nul_unchecked. Use from_ptr_unchecked instead.UCString::from_str_with_nul_unchecked. Use from_str_unchecked instead.UCString::from_os_str_with_nul_unchecked. Use from_os_str_unchecked instead.U32CString::from_chars_with_nul_unchecked. Use from_chars_unchecked instead.U32CString::from_char_ptr_with_nul_unchecked. Use from_char_ptr_unchecked instead.Nothing published for this version
Fixed compile errors on pre-1.36.0 Rust due to unstable alloc crate. Minimum supported version is Rust 1.34.2, the rust version for Debian stable. Fix
alloc crate. Minimum supported version is Rust 1.34.2, the rust version for Debian stable. Fixes #14Now supports no_std. Added the std and alloc features, enabled by default. U16String, U32String, U16CString, and U32CString and their aliases all requ
no_std. Added the std and alloc features, enabled by default. U16String,
U32String, U16CString, and U32CString and their aliases all require the alloc or std
feature. By @nicbn.Breaking Change Existing wide string types have been renamed to U16String, U16Str, U16CString, and U16CStr (previously WideString, WideStr, etc.). Som…
U32String, U32Str, U32CString, and U32CStr types for dealing with UTF-32 FFI. These
new types are roughly equivalent to the existing UTF-16 types.WideChar is a type alias to u16 on Windows but u32 on non-Windows platforms.UString, UStr, UCString and UCStr are used to implement the string
types.U16String, U16Str,
U16CString, and U16CStr (previously WideString, WideStr, etc.). Some function have
also been renamed to reflect this change (wide_str to u16_str, etc.).WideString, WideStr, WideCString, and WideCStr are now type aliases
that vary between platforms. On Windows, these are aliases to the U16 types and are equivalent
to the previous version, but on non-Windows platforms these alias the new U32 types instead.
See crate documentation for more details.Additional unchecked functions on WideCString.
WideCString.Default.WideString::shrink_to_fitWideString::into_boxed_wide_str and Box<WideStr>::into_wide_string.WideCString::into_boxed_wide_c_str and Box<WideCStr>::into_wide_c_string.From and Default implementations for boxed WideStr and boxed WideCStr.WideCString::from_vec to replace WideCString::new. To create empty string, use
WideCString::default() now.WideCString now implements Drop, which sets the string to an empty string to prevent invalid
unsafe code from working correctly when it should otherwise break. Also see Drop implementation
of CString.Make WideCString::into_raw correctly forget the original self.
WideCString::into_raw correctly forget the original self.into_raw/from_raw on WideCString. Closes #2.
into_raw/from_raw on WideCString. Closes #2.Traits for conversion of strings to Cow.
Default trait to wide strings.Cow.Nothing published for this version
One column per quarter.