-
Notifications
You must be signed in to change notification settings - Fork 25
Commit 28b8cac

Thomas Bahn
Replace
The ascii crate now provides types for owned ascii strings and borrowed
ascii slices. Their implementation should allow them to be used like
`String` and `str`.
Changes:
- `AsciiString` replaces `Vec<Ascii>`
- `AsciiStr` replaces `[Ascii]`
Migration:
- You can't construct `AsciiString` and `AsciiStr` like a collection
anymore, use the `from_bytes` method instead.
- To convert from the ascii types to bytes or strings please use the
new generic conversion traits `Into` and `AsRef`.
- The `AsciiCast` and `OwnedAsciiCast` traits are unchanged for now.
Implementations:
- `AsciiString::from_bytes` and `AsciiStr::from_bytes` for construction from
types which can be represented as a byte slice.
- Implements `fmt::{Debug, Display}` like `String` does
- `AsciiString` derefs to `AsciiStr`, additionally `DerefMut` is implemented so
`AsciiExt` is fully useable
- Implements `Hash`, `Borrow` and `ToOwned` so it can easily be used in
collections.
- Implements `PartialEq`, `PartialOrd`, `Eq` and `Ord` for itself and
`str`
- `AsciiString` implements `Into<String>`, `Into<Vec<u8>>` and
`AsRef<AsciiStr>`
- `AsciiStr` implements `AsRef<[u8]>` and `AsRef<str>`
[breaking-change]Vec<Ascii>
and [Ascii]
with newtypes1 parent 75804a2 commit 28b8cacCopy full SHA for 28b8cac
File tree
Expand file treeCollapse file tree
1 file changed
+344
-146
lines changedFilter options
- src
Expand file treeCollapse file tree
1 file changed
+344
-146
lines changed
0 commit comments