Closed createyourpersonalaccount closed 2 years ago
I noticed later that the hidden lines with #
fix this error by giving a string type to the channel. Should the examples rely on hidden #
to work? It's less obvious that there's required hidden lines when the program seems complete. I knew some of the examples were incomplete because they did not have a visible main()
, for example.
Maybe a better example would include a call to tokio::spawn
that creates a task that sends a string on each channel.
@Darksonn Perhaps the lines
# tx1.clone().send("hello").await.unwrap();
# drop((tx1, tx2, tx3));
should be unhidden? They're already there, just hidden in the source of the select.md file, not visible from the website tutorial.
Those lines don't really make a great example, is why I suggested a tokio::spawn
call. I think that would be a more realistic example.
@Darksonn
In my opinion the {:?}
fix is a simple and effective one.
You have to consider the mindset of the reader who has reached that point in the tutorial, they already understand what spawn()
does and how channels work.
I will leave this open for you to choose what to do but I will not continue beyond checking your response if you give one because we're entering bikeshedding territory.
error[E0277]:
()
doesn't implementstd::fmt::Display
.We use the display of the Debug trait instead.