-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement and document interactive mode #5
Comments
Rust streams aren't buffered by default, and the code isn't using a |
If this implies a write() system call for each output character, then that is too expensive when translating an input file with dozens of lines. We want only one write() per completely-translated symbol in order to be both efficient and interactive. Therefore, use a BufWriter with 4096 bytes, and flush it immediately after each translation. (Of course a very long translation might require intermediate flushes, which should be handled implicitly by BufWriter.) As for documentation, in README.md after the example that follows "Rustfilt can also accept data from stdin, and pipe to stdout:" then add "Each translation is output immediately after it is computed, so that rustfilt can be used interactively." |
I'm pretty sure it's a single
|
Great! Then adding a sentence to emphasize the possibility of interactive use is all that remains. |
When accepting input from stdin, then does rustfilt flush() the output after each individual translation, so that it can be used interactively? This important property deserves explicit documentation.
The text was updated successfully, but these errors were encountered: