-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
e1d380f Revamp `BufEncoder` (Martin Habovstiak) Pull request description: Due to MSRV limitation we had to previously supply the buffer externally. This can be now avoided since const generics are available. This removes the possibility of having the buffer allocated separtely from encoder but this is practically never needed. All uses construct both of them on stack, use them to encode something and then drop them. To further improve the code, this uses `ArrayString` from the `arrayvec` crate (privately). This simplifies the implementation and provides better performance since that crate uses `unsafe` to handle uninitialized bytes and doesn't need double UTF-8 check (the one we have should get optimized-out). Unfortunately, it's still not possible to implement the `AsHex` trait for all arrays but this at least simplifies the `DisplayArray` type. To avoid accidental panics its `new` method was made private and it's now constructed only with `as_hex` method. This also improves forward compatibility since we could one day change `new` to accept array instead (when const generics can accept expressions) without breaking (most of) the code. Top commit has no ACKs. Tree-SHA512: 94ed62f2dc30f0219b95ee8c9eaf52a4823d2d43aa7b00760ce7d2309b14cd4e1088a7c36f73b30ffb3e8d4d536c5c6a86b20ad716c0987cb4ca2d3056e11d05
- Loading branch information
Showing
5 changed files
with
106 additions
and
251 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
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
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
Oops, something went wrong.