Closed budde25 closed 9 months ago
Although I am not opposed to this idea but I have some doubts.
First of all is that it might cause confusion for many people especially considering the fact that the signatures of std::fnt::Write
and std::io::Write
aren't similar in any way.
Second one is more of an implementation detail: currently minus has to format all the data like wrapping it according to available number of terminal columns and highlighting the search matches. All of these can only be done to valid UTF-8 encoded String
. Also some of these operations are handled by other crates which also require the same. std::fmt::Write
is the trait that works with these conditions in place while std::io::Write
requires a &[u8]
which may or may not be valid UTF-8. I know we can surely do a String::from_utf8_lossy()
on the &[u8]
but I can't say that's a good assumption to be made.
Ah that does make sense, seems like that uft8 issue does make it a lot harder. Sounds like I just need to reconsider how I am using the library. Thanks!
Is your feature request related to a problem? Please describe.
I am trying to make function generic function that takes data and writes it to that output. Before I had it taking
std::io::Write
since that is what stdout implements. However this did not work when trying to add minus to my library since it only implementsstd::fmt::Write
.Describe the solution you'd like
std::io::Write
to be an impl for Pager.