rust-playground icon indicating copy to clipboard operation
rust-playground copied to clipboard

Allow shared code examples to include `Cargo.toml` for educational purposes.

Open daveloyall opened this issue 3 years ago • 2 comments

Hello.

Various folks use play.rust-lang.org to share code for educational purposes. Sometimes it would be useful for that code to include a Cargo.toml.

This especially includes all the examples that "just work" because of the "top 100 crates" that are included in the implicit Cargo.toml already...

daveloyall avatar Jun 08 '22 22:06 daveloyall

I encourage you to use the crate autocomplete for that, as it includes the crate version:

2022-06-08 22 30 56

otherwise, you can link to the current Cargo.toml. This is linked from the help page.

Can you be more specific about exactly what change you want to see?

shepmaster avatar Jun 09 '22 02:06 shepmaster

So far, I've only viewed code that others shared via the Playground. I haven't shared any of my own.

Now that I know a lot more about how the Playground works, I think I won't have the same kind of trouble anymore.

Maybe change how the link to Cargo.toml on the help page is described. The first time I used the Playground, I probably just clicked ❓ and then C-f cargo to search the page. That method does not highlight the link.

I read somewhere (probably in docs I found on rust-lang.org) that snippets of Rust are meaningless without a Cargo.toml. ..I'm sure I'm paraphrasing. Maybe that is why I found the Playground confusing before I knew (a bit about) how it works.

daveloyall avatar Jun 09 '22 17:06 daveloyall