Skip to content

1.0.0-beta.1

Pre-release
Pre-release
Compare
Choose a tag to compare
@starkat99 starkat99 released this 08 Nov 20:04
· 40 commits to main since this release
49e4bb0

Changed

  • Breaking Change Minimum supported Rust version is now 1.56.
  • Breaking Change The following methods on U16String and U32String have been renamed and replaced by functions with different semantics:
    • pop is now pop_char
    • remove is now remove_char
    • insert is now insert_char
  • Breaking Change Moved and renamed the following iterator types:
    • iter::Utf16Chars renamed to CharsUtf16 and moved to ustr and ucstr
    • iter::Utf32Chars renamed to CharsUtf32 and moved to ustr and ucstr
    • iter::CharsLossy split and renamed to CharsLossyUtf16 and CharsLossyUtf32 and moved to ustr and ucstr
    • iter::Utf16CharIndices renamed to CharIndicesUtf16 and moved to ustr and ucstr
    • iter::Utf16CharIndicesLossy renamed to CharIndicesLossyUtf16 and moved to ustr and ucstr
  • Breaking Change error::FromUtf16Error and error::FromUtf32Error has been renamed to Utf16Error and Utf32Error respectively and expanded with more details about the error.
  • Migrated crate to Rust 2021 edition.
  • The following methods on U16Str and U32Str are now const:
    • from_slice
    • as_slice
    • as_ptr
    • len
    • is_empty
  • The following methods on U16CStr and U32CStr are now const:
    • from_slice_unchecked
    • as_slice_with_nul
    • as_ptr
    • len
    • is_empty
  • The following methods on U16String and U32String are now const:
    • new

Added

  • Added new UTF-encoded string types and associated types:
    • Utf16Str
    • Utf32Str
    • Utf16String
    • Utf32String
  • Added macros to convert string literals into const wide string slices:
    • u16str!
    • u16cstr!
    • u32str!
    • u32cstr!
    • widestr!
    • widecstr!
    • utf16str!
    • utf32str!
  • Added NUL_TERMINATOR associated constant to U16CStr, U32CStr, U16CString, and U32CString.
  • Added DoubleEndedIterator and ExactSizeIterator implementations to a number of iterator types.
  • Added new UTF encoding functions alongside existing decode functions:
    • encode_utf8
    • encode_utf16
    • encode_utf32
  • Added various methods:
    • repeat on U16Str, U32Str, U16CStr, and U32CStr
    • shrink_to on U16String and U32String
    • retain on U16String and U32String
    • drain on U16String and U32String
    • replace_range on U16String and U32String
    • get, get_mut, get_unchecked, and get_unchecked_mut on U16CStr and U32CStr
    • split_at and split_at_mut on U16CStr and U32CStr
  • Added more trait implementations.

Removed

  • Breaking Change Functions and types deprecated in 0.5 have been removed.
  • Breaking Change The following types and traits, which were implementation details, have been removed. Use the existing non-generic types instead (e.g. use U16Str instead of UStr<u16>).
    • UChar
    • UStr
    • UCStr
    • UString
    • UCString
  • Breaking Change Removed IndexMut<RangeFull> trait implementation of U16CString and U32CString. Use the unsafe get_mut method instead, which also supports more ranges.

Fixed

  • Breaking Change The iterator returned by 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.