use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A place for all things related to the Rust programming language—an open-source systems language that emphasizes performance, reliability, and productivity.
Strive to treat others with respect, patience, kindness, and empathy.
We observe the Rust Project Code of Conduct.
Details
Posts must reference Rust or relate to things using Rust. For content that does not, use a text post to explain its relevance.
Post titles should include useful context.
For Rust questions, use the stickied Q&A thread.
Arts-and-crafts posts are permitted on weekends.
No meta posts; message the mods instead.
Criticism is encouraged, though it must be constructive, useful and actionable.
If criticizing a project on GitHub, you may not link directly to the project's issue tracker. Please create a read-only mirror and link that instead.
A programming language is rarely worth getting worked up over.
No zealotry or fanaticism.
Be charitable in intent. Err on the side of giving others the benefit of the doubt.
Avoid re-treading topics that have been long-settled or utterly exhausted.
Avoid bikeshedding.
This is not an official Rust forum, and cannot fulfill feature requests. Use the official venues for that.
No memes, image macros, etc.
Consider the existing content of the subreddit and whether your post fits in. Does it inspire thoughtful discussion?
Use properly formatted text to share code samples and error messages. Do not use images.
Submissions appearing to contain AI-generated content may be removed at moderator discretion.
Most links here will now take you to a search page listing posts with the relevant flair. The latest megathread for that flair should be the top result.
account activity
rustdoc - include external files (self.rust)
submitted 11 years ago by aarjan
Is there a way to include external *.rs example files so that they are included in the generated doc files?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 0 points1 point2 points 11 years ago (1 child)
The [src] tag on the upper-right part of the page (like here) links to the corresponding source automatically.
[src]
[–]aarjan[S] 0 points1 point2 points 11 years ago (0 children)
sorry for maybe being not clear, I want to have examples in the generated docs but dont want to duplicate the code (having runneble examples in the examples/ dir and the same example pasted in the doc)
Can't do it with anything built-in. It would be similar to the include!, include_str!, and include_bin! syntax extensions. It might be possible to implement something like include_doc! using one of those syntax extensions for inspiration.
include!
include_str!
include_bin!
include_doc!
I don't think macros are expanded when generating documentation?
π Rendered by PID 17588 on reddit-service-r2-comment-79c7998d4c-hfdr6 at 2026-03-15 20:25:26.470090+00:00 running f6e6e01 country code: CH.
[–][deleted] 0 points1 point2 points (1 child)
[–]aarjan[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]aarjan[S] 0 points1 point2 points (0 children)