-
Notifications
You must be signed in to change notification settings - Fork 34
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
Tutorial: Draft of Output chapter #52
Conversation
110e36f
to
e3f9d78
Compare
For this, you should try to printing useful status updates, | ||
ideally in a form that can be easily consumed. | ||
|
||
Using the [indicatif] crate, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we only want to mention one crate here or maybe also link to https://github.com/FGRibreau/spinners (it has a shark
spinner! 🦈 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to expand this with an example that uses indicatif to show progress as well as log messages. The spinners crate can't do that afaik
src/tutorial/output.md
Outdated
|
||
will print | ||
|
||
> My lucky number is 42. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
supernit: you can use ```console
So it looks like this:
My lucky number is 42.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I <3 super nits, thanks!
env_logger? | ||
|
||
</aside> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add TODO for escaping symbols in stdout/stderr?
Maybe it needs a tracking issue first, in particular I'm getting problems piping ssh
to the stdout and stderr of my Rust program, it breaks the terminal (macOS standard Terminal.app) state quite often and I have to fix it like that:
$ stty sane
But ideally I need to figure what symbols cause that and how to escape them…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I hadn't heard of that. Can you open an issue? One goal of the issue might be to add a section to the book :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, here we go #57
I'll merge this and will expand it in future PRs! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I complained a bit more as requested 😬
but also a special syntax. | ||
It expects you to write, | ||
as a first parameter, | ||
a literal string that with placeholders, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sentence is a bit clunky.
"It expects you to write a string literal as the first parameter, that contains placeholders that will be filled in [...]"
For numbers and strings this works very well, | ||
but not all types can do that. | ||
This is why there is also a "debug representation", | ||
that you can get by filling the braces of the placeholder like this: `{:?}`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are many more od these, maybe we want to link to the section in the book where they're explained?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's a link to the std::fmt docs in the very next aside
|
||
**TODO:** | ||
crate for actual log output -- which one? | ||
env_logger? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to include several and compare? The book is supposed to be curated content, right? So maybe keeping a list of actively developed loggers isn't a bad idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, but this is also the tutorial. I'll add a todo to link to ../in-depth/human-communication.html
:)
No description provided.