jrvidal / explaine.rs Goto Github PK
View Code? Open in Web Editor NEWAn interactive Rust syntax playground
Home Page: https://jrvidal.github.io/explaine.rs
An interactive Rust syntax playground
Home Page: https://jrvidal.github.io/explaine.rs
::
is the path separator (https://doc.rust-lang.org/book/appendix-02-operators.html)
4 | let list_tables = ListTablesOperation::new().limit(50).build(dynamo_config);
| ↑
9 | }
Location: line 4, column 41
This is awesome for learning!
I wonder if it could be possible to somehow combine this with rust-patterns to also show common idiomatic constructs used throughout Rust programs?
Adding an extra &edition=2018
param to "Open in Playground" button will activate the recent Rust 2018 edition by default.
Tapping on text doesn't seem to work.
I'm on Chrome for Android.
Chrome v80.0.3987.162
Android 9
?Sized Trait Bound
A bound that expresses that the Sized trait may not be implemented for a given type parameter.
is what the website says. I think it should say "may or may not" instead, like in the Rust book.
Generated links don't work. Here is a link I've just generated:
https://jrvidal.github.io/?code=fn%20main()%7B%7D
I get error 404 when I try to access it.
It looks like the correct link should be
https://jrvidal.github.io/explaine.rs/?code=fn%20main()%7B%7D
i.e. recognize #[derive(...)]
, #[cfg(...)]
, etc. and link to the Rust reference.
Brief explanation of type annotations (and possibly link to book).
0 | fn main() {
1 | let mut rdr: Box<io::Read> = match input {
| ↑-------------↑
2 | "-" => Box::new(io::stdin()),
3 | _ => Box::new(fs::File::open(input).unwrap()),
4 | };
5 | }
Location: line 1, column 13
1 | fn lol(a: Box<for<'a> fn(x:&'a u32)->()>) {
| ↑
2 | }
Location: line 1, column 15
"Function Type. The type of a free standing function." spanning the whole generic argument of the Box
.
"The type of a free standing function" can contain many tricky things inside it. I expect some individual tokens within that type to be selectable.
It would be super awesome to have a hint for '
lifetime annotations, since they're non-trivial to google for when you don't know what they're called.
I hope I'm getting the terminology right here. For the example code, I used an example from https://doc.rust-lang.org/1.9.0/book/lifetimes.html
0 | struct Foo<'a> {
| /* ↑ lifetime annotation */
1 | x: &'a i32,
| /* ↑ lifetime annotation */
2 | }
Please see https://users.rust-lang.org/t/a-question-about-syntax/52790/2 & https://doc.rust-lang.org/stable/book/ch19-03-advanced-traits.html#default-generic-type-parameters-and-operator-overloading.
0 | struct Foo<T = String>(T);
| ↑
1 |
2 | fn main() {
3 | let x: Foo = Foo(String::from("thunk"));
4 | let y: Foo<i32> = Foo(17);
5 | }
Location: line 0, column 13
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.