Skip to content
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

Allow "expanding" and "running" code examples in guide. #1274

Open
zohaad opened this issue Apr 12, 2020 · 2 comments
Open

Allow "expanding" and "running" code examples in guide. #1274

zohaad opened this issue Apr 12, 2020 · 2 comments
Labels
docs Improvements or additions to documentation suggestion A suggestion to change functionality

Comments

@zohaad
Copy link

zohaad commented Apr 12, 2020

Suggestion: make code examples on rocket.rs compilable like in the "expandable view" for the rust book code examples.

@jebrosen jebrosen added docs Improvements or additions to documentation suggestion A suggestion to change functionality labels Apr 13, 2020
@jebrosen
Copy link
Collaborator

This needs a bit more thought before anything could be implemented. There are a few major differences from the rust book:

  • The Book uses play.rust-lang.org to run code, which doesn't include rocket. We would either need to get rocket into the rust playground, or to duplicate it to some extent.
  • In order for most examples to be useful, an example request is also needed. I think this goes beyond what we can expect from play.rust-lang.org, again pointing to needing to duplicate it in some way.
  • Many examples are partial examples - routes that are never mounted, request guards that are never invoked, etc. Sometimes there is a "full example" at the end that brings them all together, and probably only that one should be "playable".

The need to duplicate and/or extend functionality from the playground looks like the biggest issue: it's significantly more difficult to maintain than rocket.rs is, unless there are existing code playpens besides play.rust-lang.org that we could integrate somehow.

@SergioBenitez SergioBenitez changed the title Suggestion: make code examples compilable Allow "expanding" and "running" code examples in guide. Apr 8, 2021
@chinoto
Copy link

chinoto commented Oct 7, 2022

It would probably be too demanding, but I wonder if something in browser could be accomplished like WordPress is doing. Supposedly miri would be easier to compile to wasm that rustc: rust-lang/miri#722

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation suggestion A suggestion to change functionality
Projects
None yet
Development

No branches or pull requests

3 participants