Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently console only reads input from stdin. However a ReadWritePair option has already been added. Unfortunately only writing works for ReadWritePair. This PR adds functionality for a custom input source.
See issue #108
See other (I think incomplete) pr addressing this issue: #123
This would complete the work of #93
Therefore the following lines have been changed:
console/src/term.rs
Line 291 in 51425fc
console/src/term.rs
Line 617 in 51425fc
console/src/term.rs
Line 623 in 51425fc
console/src/term.rs
Line 343 in 51425fc
console/src/term.rs
Line 278 in 51425fc
ReadWritePair was also modified. Previously it required an input source of type Read (enables reading of bytes)
This has been changed to an iterator over Keys because Keys are a cross platform solution. Else we would need to parse the input differently depending on the os of the user. Now the user has a nice interface for defining his own input source.
Functionality may be expanded in the future to support more keys, or to automatically convert something like Key::Char('\n') to Key::Enter or at least warn the user.
This pr should be a good start adding an essential feature.
Please take a look at the commits from last to newest. They contain a description of what has been changed.