Permalink
Please sign in to comment.
Browse files
Support painting bytestrings
Applications working with text in unknown or non-UTF-8 character sets need to handle that text as opaque [u8] bytestrings. For example, git diffs from git2-rs provide the diff text as [u8] bytestrings, because the files diffed might not use UTF-8. Add support for painting [u8] bytestrings, producing a new ANSIByteString type. Add an ANSIByteStrings type to print many ANSIByteString values with minimal escape sequences. To avoid duplicating code for str and [u8], introduce generic versions of ANSIString and ANSIStrings, with the specific versions for str and [u8] as type aliases. Also introduce a private trait AnyWrite to abstract code that works with either fmt::Write and io::Write. This implementation provides full source compatibility with code written for previous versions of ansi_term. All the existing tests pass unmodified. Nonetheless, this should likely bump the version to 0.9.0, because the introduction of generic types may potentially affect type inference. Extend the testsuite to run all the tests on ANSIByteString, as well.
- Loading branch information...
Oops, something went wrong.
0 comments on commit
a0da28a