The Rust playground is one of the many great things about Rust.
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?
Looks like it's heavily inspired by the Go playground (which took it's inspiration also elsewhere, but afaik was a first for a compiled language).
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.
I really like to use CodeRunner for these types of purposes, I just save off the snippets of code into a folder so I can easily locate those ideas/thoughts/snippets later.
Something I really like about the Typescript playground is it has lots of examples with documentation and, not to put too fine a point on it, they all compile and run. Obviously this isn't designed for the same use case, but it'd be nice (from my perspective!) to be able to load in some example code that already works and doesn't produce an inscrutable (to a beginner) compile error.
I'm sure this would be a great resource if I did start trying to learn the language though, so thanks for sharing it :)
Yeah, the relationship is a bit different. In Rust, we tend to have docs that embed the playground or link to it, rather than having the playground link to docs.
Output of the default code in the app generates errors:
=================
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've wanted to turn some students onto Rust, so I tried to give them https://github.com/rust-lang/rustlings loaded into a repl.it account -- but the way repl.it works breaks rustlings in multiple ways.
I'd love if this Rust playground could eventually provide that experience.
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.
https://coderunnerapp.com
> 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.
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 :)
=================
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.
https://godbolt.org/z/qM67Pe
Dropdown menu next to run, select "asm".