Closed
Description
I'd like to see some example rust programs on the wiki or even on the main page. These should:
- Not be purely artificial: ideally they should do something resembling useful work.
- Be written in idiomatic, well-commented, up to date rust code.
- Cover all the high points of the language.
- Be executed as part of the rustc test framework.
- Show up on the web page using syntax highlighting.
- The web page should list names of the examples, include a brief description, and mention topics addressed by the example.
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
jesse99 commentedon Sep 23, 2012
I'm planning on writing four of these:
jesse99 commentedon Sep 23, 2012
Here's the ascii art example. I decided not to include operator overloading:
jesse99 commentedon Sep 23, 2012
Here's a task example:
brson commentedon Sep 23, 2012
This sounds like a great idea to me. To keep it up building we will need to put it in the repo (at least for now - I'd also like to scrape the wiki for test cases).
FWIW, I updated the FAQ recently to link to interesting bits of code around the Rust-sphere.
jesse99 commentedon Sep 23, 2012
I figured they'd go into the repo at some point. But I'd like to see some example code on the wiki for 0.4, even if there isn't time to integrate them with git and testing.
jesse99 commentedon Sep 24, 2012
Here is a multi-file crate example.
crate.rc:
main.rs:
options.rs:
config.json:
brson commentedon Sep 26, 2012
Putting these in doc/example-foo.md and hooking them up to the test driver in mk/tests.mk would be a good way to keep them building. The multi-file example would need some new support in extract-tests.py. They could be linked from the 'What next?' section of the tutorial.
brson commentedon Sep 29, 2012
Somebody posted a nice example http://www.reddit.com/r/rust/comments/10lmg0/example_in_rust_04_conways_game_of_life/
jesse99 commentedon Oct 7, 2012
Here is another:
jesse99 commentedon Oct 30, 2012
Forgot to add this one. It's an example of how to create and use a multi-file rust library.
First the library.
sxml.rc
xsml.rs
parsing.rs
validation.rs
Then an exe that pulls in the library.
client.rc
client.rs
secunit64 commentedon Nov 26, 2012
FWIW, I am building a set of examples starting from simple ones & evolving them into more complex examples. You can find them here: https://github.com/smadhueagle/rustlings. I am also creating a utils module of various helper functions here: https://github.com/smadhueagle/rustils.
Very early stages, but I am picking up the language real fast, so expect more to come. All are based on rust-v0.4
catamorphism commentedon May 22, 2013
Nominating for milestone 4, well-covered
graydon commentedon Jun 13, 2013
I guess I concur, though I think this bug might be too vague to know when to close.
graydon commentedon Jun 20, 2013
just a bug, removing milestone/nomination.
emberian commentedon Aug 5, 2013
Visiting for triage, nothing to add.
8 remaining items