-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
examples #3562
Comments
I'm planning on writing four of these:
|
Here's the ascii art example. I decided not to include operator overloading:
|
Here's a task example:
|
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. |
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. |
Here is a multi-file crate example. crate.rc:
main.rs:
options.rs:
config.json:
|
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. |
Somebody posted a nice example http://www.reddit.com/r/rust/comments/10lmg0/example_in_rust_04_conways_game_of_life/ |
Here is another:
|
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
|
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 |
Nominating for milestone 4, well-covered |
I guess I concur, though I think this bug might be too vague to know when to close. |
just a bug, removing milestone/nomination. |
Visiting for triage, nothing to add. |
Nothing to add, although https://github.com/Hoverbear/rust-rosetta is starting to pick up some examples. |
I'm collecting external example sites https://github.com/mozilla/rust/wiki/Doc-examples Would love for somebody to consolidate this stuff, put it in the official repo for maintenance. |
I'm working on writing some programs from coreutils here: https://github.com/gsingh93/rust-coreutils I'm still pretty new to rust and I'm writing these just for practice, but at some point there might be some good examples in there. |
I am not sure this is exactly relevant anymore. I think it should be closed. |
I agree. We have made a lot of progress since this was opened, and I think that more specific issues should be opened if there are any lingering points to address. |
only show the 'basic API common for this target' message when this is a missing foreign function Follow-up to rust-lang/miri#3558
I'd like to see some example rust programs on the wiki or even on the main page. These should:
The text was updated successfully, but these errors were encountered: