- Add alloc feature.
This enables
AsciiString
and methods that take or returnBox<[AsciiStr]>
in!#[no_std]
-mode. - Add
AsciiStr::into_ascii_string()
,AsciiString::into_boxed_ascii_str()
andAsciiString::insert_str()
. - Implement
From<Box<AsciiStr>>
andFrom<AsciiChar>
forAsciiString
. - Implement
From<AsciiString>
forBox<AsciiStr>
,Rc<AsciiStr>
,Arc<AsciiStr>
andVec<AsciiChar>
. - Make
AsciiString::new()
,AsciiStr::len()
andAsciiStr::is_empty()
const fn
. - Require Rust 1.44.1.
Breaking changes:
- Change
AsciiChar.is_whitespace()
to also return true for '\0xb' (vertical tab) and '\0xc' (form feed). - Remove quickcheck feature.
- Remove
AsciiStr::new()
. - Rename
AsciiChar::from()
andAsciiChar::from_unchecked()
tofrom_ascii()
andfrom_ascii_unchecked()
. - Rename several
AsciiChar.is_xxx()
methods tois_ascii_xxx()
(for comsistency with std). - Rename
AsciiChar::Null
toNul
(for consistency with eg.CStr::from_bytes_with_nul()
). - Rename
AsciiStr.trim_left()
andAsciiStr.trim_right()
totrim_start()
andtrim_end()
. - Remove impls of the deprecated
std::ascii::AsciiExt
trait. - Change iterators
Chars
,CharsMut
andCharsRef
from type aliases to newtypes. - Return
impl Trait
fromAsciiStr.lines()
andAsciiStr.split()
, and remove iterator typesLines
andSplit
. - Add
slice_ascii_str()
,get_ascii()
andunwrap_ascii()
to theAsAsciiStr
trait. - Add
slice_mut_ascii_str()
andunwrap_ascii_mut()
to theAsMutAsciiStr
trait. - Require Rust 1.33.0 for 1.0.*, and allow later semver-compatible 1.y.0 releases to increase it.
Additions:
- Add
const fn
AsciiChar::new()
which panicks on invalid values. - Make most
AsciiChar
methodsconst fn
. - Add multiple
AsciiChar::is_[ascii_]xxx()
methods. - Implement
AsRef<AsciiStr>
forAsciiChar
. - Make
AsciiString
'sExtend
andFromIterator
impl generic over allAsRef<AsciiStr>
. - Implement inclusive range indexing for
AsciiStr
(and therebyAsciiString
). - Mark
AsciiStr
andAsciiString
#[repr(transparent)]
(to[AsciiChar]
andVec<AsciiChar>
respectively).
Soundness fix:
Remove unsound impls of From<&mut AsciiStr>
for &mut [u8]
and &mut str
.
This is a breaking change, but theese impls can lead to undefined behavior in safe code.
If you use this impl and know that non-ASCII values are never inserted into the [u8]
or str
,
you can pin ascii to 0.9.2.
Other changes:
- Make quickcheck
Arbitrary
impl sometimes produceAsciiChar::DEL
. - Implement
Clone
,Copy
andEq
forToAsciiCharError
. - Implement
ToAsciiChar
foru16
,u32
andi8
.
- Implement the
IntoAsciiString
trait forstd::ffi::CStr
andstd::ffi::CString
types, and implemented theAsAsciiStr
trait forstd::ffi::CStr
type. - Implement the
IntoAsciiString
forstd::borrow::Cow
, where the inner types themselves implementIntoAsciiString
. - Implement conversions between
AsciiString
andCow<'a, AsciiStr>
. - Implement the
std::ops::AddAssign
trait forAsciiString
. - Implement
BorrowMut<AsciiStr>
,AsRef<[AsciiChar]>
,AsRef<str>
,AsMut<[AsciiChar]>
forAsciiString
. - Implement
PartialEq<[u8]>
andPartialEq<[AsciiChar]>
forAsciiStr
. - Add
AsciiStr::first()
,AsciiStr::last()
andAsciiStr::split()
methods. - Implement
DoubleEndedIterator
forAsciiStr::lines()
. - Implement
AsRef<AsciiStr>
andAsMut<AsciiStr
for[AsciiChar]
. - Implement
Default
forAsciiChar
.
- Implement the
serde::Serialize
andserde::Deserialize
traits forAsciiChar
,AsciiStr
, andAsciiString
. The implementation is enabled by theserde
feature. - Bugfix:
AsciiStr::lines()
now behaves similar tostr::lines()
. (#51)
- Update the optional
quickcheck
feature to version 0.6.
- Implement
AsAsciiStr
andAsMutAsciiStr
for references to to types that implement them. - Make all methods of deprecated
AsciiExt
exceptis_ascii()
available as inherent methods in std-mode. - Compile without warnings on Rust 1.26.0
- Acknowledge that the crate doesn't compile on Rust < 1.8.0 (cannot be fixed without breaking changes).
- Implement
AsRef<u8> for AsciiString
.
- Fix the tests when running without std.
- Bugfix:
<AsciiStr as AsciiExt>::to_ascii_lowercase
did erroneously convert to uppercase.
- Implement
IntoAsciiString
for&'a str
and&'a [u8]
. - Implement the
quickcheck::Arbitrary
trait forAsciiChar
andAsciiString
. The implementation is enabled by thequickcheck
feature.
- Add
Chars
,CharsMut
andLines
iterators. - Implement
std::fmt::Write
forAsciiString
.
Breaking changes:
- Return
FromAsciiError
instead of the input whenAsciiString::from_ascii()
orinto_ascii_string()
fails. - Replace the
no_std
feature with the additivestd
feature, which is part of the default features. (Issue #29) AsciiChar::is_*()
and::as_{byte,char}()
takeself
by value instead of by reference.
Additions:
- Make
AsciiChar
comparable withchar
andu8
. - Add
AsciiChar::as_printable_char()
and the free functionscaret_encode()
andcaret_decode()
. - Implement some methods from
AsciiExt
andError
(which are not in libcore) directly incore
mode:Ascii{Char,Str}::eq_ignore_ascii_case()
AsciiChar::to_ascii_{upper,lower}case()
AsciiStr::make_ascii_{upper,lower}case()
{ToAsciiChar,AsAsciiStr}Error::description()
- Fix the implementation of
AsciiExt::to_ascii_lowercase()
forAsciiChar
converting to uppercase. (introduced in 0.7.0)
- Rename
Ascii
toAsciiChar
and convert it into an enum. (with a variant for every ASCII character) - Replace
OwnedAsciiCast
withIntoAsciiString
. - Replace
AsciiCast
withAs[Mut]AsciiStr
andIntoAsciiChar
. - Add from[_ascii]_unchecked methods.
- Replace from_bytes with from_ascii in method names.
- Return
std::error::Error
-implementing types instead of()
andNone
when conversion toAsciiStr
orAsciiChar
fails. - Implement
AsciiExt
without theunstable
Cargo feature flag, which is removed. - Require Rust 1.9 or later.
- Add
#[no_std]
support in a Cargo feature. - Implement
From<{&,&mut,Box<}AsciiStr>
for[Ascii]
,[u8]
andstr
- Implement
From<{&,&mut,Box<}[Ascii]>
,As{Ref,Mut}<[Ascii]>
and Default forAsciiStr
- Implement
From<Vec<Ascii>>
forAsciiString
. - Implement
AsMut<AsciiStr>
forAsciiString
. - Stop some
Ascii::is_xxx()
methods from panicking. - Add
Ascii::is_whitespace()
. - Add
AsciiString::as_mut_slice()
. - Add raw pointer methods on
AsciiString
:from_raw_parts
as_ptr
as_mut_ptr
- Add
Ascii::from_byte()
- Add
AsciiStr::trim[_{left,right}]()
Implement IndexMut
for AsciiStr and AsciiString.
- Add
Ascii::from()
. - Implement
Index
forAsciiStr
andAsciiString
. - Implement
Default
,FromIterator
,Extend
andAdd
forAsciiString
- Added inherent methods on
AsciiString
:with_capacity
push_str
capacity
reserve
reserve_exact
shrink_to_fit
push
truncate
pop
remove
insert
len
is_empty
clear
First release compatible with Rust 1.0.0.