-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
api: add more
Borrow
and BorrowMut
trait impls
These additions allow `BStr`s and `BString`s to be used as lookup keys in `HashMap`s containing byte slices, byte vecs, and strings. I mirrored these impls off of the ones in `std`. There is some concern that these impls aren't appropriate for one reason or another. For example, std has a `AsRef<[u8]>` impl for `str` but not a `Borrow<[u8]>` impl. So one wonders whether we should do the same for the `BStr` and `BString` types. But the bstr types are true wrappers around `[u8]` and `Vec<u8>` in the sense that they implement `Deref` and `DerefMut`. That is, they are meant to be essentially equivalent in every way. The only reason they really exist is for type level shenanigans. (e.g., Acting as a target for trait impls like for Serde and std::fmt::Debug.) Closes #157
- Loading branch information
1 parent
7d96589
commit f639abd
Showing
1 changed file
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters