-
Notifications
You must be signed in to change notification settings - Fork 1.7k
enable play
button only if play.rust-lang.org supports used crates.
#396
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
Comments
I am not sure we should rely on
Therefore I would recommend to not use this feature in a book. It is highly unreliable for long term documentation.
This would stil be confusing for the user, albeit somewhat less, because one day the play button might be there and then the next it could be gone. |
yep the current situation is not very nice. Abut arguably enabling the play button by default might be even worse because the button will stop working without any warning.
maybe an opt in variant via options. I for one am able to live with play button disappearing from time to time in the cookbook as it is a very desired feature by the users. Maybe we can make the play button disabled with tooltip ("unsupported crates" or something) if the playgraund does not support the given crate set. Also as mentioned earlier we might hope for some stabilization with rust-lang/rust-playground#168 |
Why did you close the issue? 😄 I have a proposal that you might like. requirements
proposal {{#playpen foo.rs extern-crates }} The warning should state that this feature is highly unstable due to the constraints of the playground and that working snippets may break at any time.
I like that idea! This would only catch crates that are not in the list and not the ones with incompatible versions but it's already something. |
Sorry wrong button. I'm a little preoccupied at the moment ;)
please note that a major usecase for playgraund are the inline markdown rust snippets. For instance cookbook does not use the I guess that from book writer perspective (as cookbook mainter) I would prefer to have a global opt in option in book.toml instead of per snippet basis (this would add a lot of noise). Also where would you prefer to for the erroring/warning to occur? In
I certainly would not like to go into versioning rabbit hole ;). I feel that It is book authors/maintainers role to keep the examples compiling and in sync using |
I am not sure I understand what you mean by that, do you mean they use it just as an include? |
Sorry (as I said I'm multitasking now and the results are less than coherent 😸 ). What meant is that the play button appears also in the markdown rust snippets ```rust fn main(){ println!("blah!"); } ``` So any functionality added to |
Oh yes, you are right. I forgot that... |
Well it isn't that bad of a default. rust-book and RBE assume that all snippets are runnable and could live with some snippets being "opt out" instead of all snippets being "opt in" runnable. I would propose to make the ```rust, no_run fn main(){ println!("blah!"); } ```
|
@azerupi the rust-lang/rust-playground#198 has enabled a lot of crates on rust-playground |
Hi,
rust-lang-nursery/rust-cookbook#87 Is a long standing bug in cookbook. We were forced to disabled the (awesome) play button due to its inconsistent behavior.
Firstly play.rust-lang.org did not support
extern crate
at all.Now it supports the top 100 crates from crates.io which is a dynamic property.
Having the play button enabled by default is arguably not the best user experience (it's safe for std only snippets but its hit and miss with
extern crate
. To make it worse, the experience can degrade/upgrade dynamically day by day)We can query the installed crate list https://play.rust-lang.org/meta/crates on each page load (if playpen snippets present) and selectively enable the button if playpen snippet:
no_run
We should be able to get
extern crate
from snippets easily with some js regex;Eventually the rust playground might start offering a curated crate list too rust-lang/rust-playground#168
The text was updated successfully, but these errors were encountered: