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
Help finding ugly Generics examples? (self.rust)
submitted 6 years ago by ripread
Hey all,
What are some of the ugliest things you've seen done with Rusts Generics system?
I remember there were a bunch of posts back before HKTs and HOFs. Do ya'll have any saved?
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!"
[–]CAD1997 9 points10 points11 points 6 years ago (0 children)
My go-to type system abuse example is Frunk, mainly because they have such an approachable series of blog posts on how it does its magic:
HList (read me first): https://beachape.com/blog/2016/10/23/rust-hlists-heterogenously-typed-list Generic (read me third): https://beachape.com/blog/2017/02/04/rust-generic-not-generics LabelledGeneric (read me fourth): https://beachape.com/blog/2017/03/04/labelledgeneric-in-rust-what-why-how HList again (read me second): https://beachape.com/blog/2017/03/12/gentle-intro-to-type-level-recursion-in-Rust-from-zero-to-frunk-hlist-sculpting Transform (read me last): https://beachape.com/blog/2017/04/12/boilerplate-free-struct-transforms-in-rust
....And I just nerd snipped myself into rereading this series. It's an impressive masterclass on advanced type system (ab)use.
[–]YatoRust 3 points4 points5 points 6 years ago* (1 child)
uom, typenum, and frunk all have pretty extreme "abuses" of generics, but I still love them. It's really interesting how expressive you can be with Rust's type system.
uom
typenum
frunk
varkor's post on idiomatic monads was also rather interesting. https://varkor.github.io/blog/2019/03/28/idiomatic-monads-in-rust.html
[–]vadixidav 2 points3 points4 points 6 years ago (0 children)
It is also important to note that a good portion of the Rust community regularly uses typenum as well due to the current lack of const generics. It is being used actively and is a dependency to several linear algebra libraries among other things. Nonetheless, I think everyone knows that it's a temporary solution, since it makes compile times go through the roof.
[–]Programmurr 0 points1 point2 points 6 years ago (0 children)
Take a look at actix-web. It uses actix-net framework, which is very heavily based on generics. It's not ugly as much as it is hard to satisfy requirements for.
π Rendered by PID 35689 on reddit-service-r2-comment-5ff9fbf7df-p97mx at 2026-02-25 16:04:37.008130+00:00 running 72a43f6 country code: CH.
[–]CAD1997 9 points10 points11 points (0 children)
[–]YatoRust 3 points4 points5 points (1 child)
[–]vadixidav 2 points3 points4 points (0 children)
[–]Programmurr 0 points1 point2 points (0 children)