Rust Playground
play.rust-lang.org
play.rust-lang.org
It's really helpful to share code and try concepts. The mere existence of the playground is a catalyst to reduce and refine problems before airing them to get help from the wider community.
Furthermore it's well integrated with the Rust community forums. The share button functionality is brilliant.
A minor quibble: its state management is not particularly intuitive. There's no notion of "save" or "branch" or versions as in Gists, for example. If there is, I haven't found it. The playground URL appears to be a hash of its contents? That's my guess. Does anybody know?
> Does anybody know?
Yes, there's no branching for gists, but there are saves. If you hit "Share", you get various options:
* Permalink to the playground <- this creates a gist. URL is the gist hash.
* Direct link to the gist <- this gives you a link to the gist
* Embedded code in link <- this URLencodes the source and puts it in a parameter
* Open a new thread in the Rust user forum & Open an issue on the Rust GitHub repository <- hopefully self-explanatory
There's always a trade-off between ease of use and flexibility, and I think the KISS principle is great for a tool like this. Never used it for Rust (only playing with it at the moment) - but in the Go world it's also referenced and used everywhere.
> The Rust playground is pretty dope. D*mn near a full blown IDE running in your browser ...
I am not a fan of exaggeration. No, it is not ‘near’ a full-blown IDE.
That said, I think the Playground is wonderful, especially for a compiled language.
- edit multiple files
- search across files
- console/terminal
- debugging
- customizable keyboard shortcuts
- source control integration
- extensions/plugins
Optional: - long startup times
- complicated and overly nested settings
- run-amok CPU-hogging pluginsBut anyway, the Rust playground has none of those anyway.
The cargo ecosystem is painfully getting a bit too npm-like and the top100 doesn't always have some basic needs.
What do you mean by "npm-like"?
Rust does sound interesting but I’m holding out until the job market begins to grow.
Corporate America tends to be slow in adopting new technologies.
Heck I think Java 8 is still the most popular version of a Java.
I'm sure this would be a great resource if I did start trying to learn the language though, so thanks for sharing it :)
You can click the arrows to run the code. This effectively makes an AJAX call to the playpen, and puts the results back on the page.
Here's a random page from the API docs: https://doc.rust-lang.org/stable/std/string/struct.String.ht...
Those "run" buttons will open up the example in the playpen so you can play around with it.
I think ideally these would all let you edit in place, run in the page, or open in the playpen, but they use slightly different tooling and nobody has put in the work to make it all identical yet.
=================
Compiling playground v0.0.1 (/playground)
error: unexpected token: `...`
--> src/main.rs:13:15
|
13 | for x in 0...10 {
| ^^^
|
help: use `..` for an exclusive range
|
13 | for x in 0..10 {
| ^^
help: or `..=` for an inclusive range
|
13 | for x in 0..=10 {
| ^^^error: aborting due to previous error
error: could not compile `playground`.
To learn more, run the command again with --verbose.
I'd love if this Rust playground could eventually provide that experience.
Dropdown menu next to run, select "asm".
Edit: reloading the page fixed it.