Suggestion: Traitopedia

Would be awesome to have something like a Trait Encyclopedia.

Not sure exactly how it would be built, or what the search options would look like... but I think as one gets more comfortable with the basic syntax and properties of Rust, the question of "Is there a trait that does x" or "I keep seeing this trait x everywhere, what's it used for" keeps coming up when moving from say a fresh beginner to a beginner/intermediate level.

The Haskell Typeclassopedia could be good for inspiration... not necessarily for the content but for the concept. In other words - not just looking at each trait from one angle of signature+description, but from multiple angles... "what problem it solves", "how it's different from similar traits", etc.

Just putting this out there in case anyone is looking for something to do :wink:

9 Likes

Isn't it called just documentation?

1 Like

The problem with the documentation as it stands right now is that you have to know what you're looking for before you can learn about it.

For example - afaik there is no unified page of documentation which lists both AsRef and Mul and helps build an intuition for situations I'd want to use them (that last bit is actually really important imho - even if it's just a few lines with a link to learn more).

I might find these Traits by searching "how to generic trait ref" or "how to overload multiply operator" - and depending on my google-fu I might end up at their individual documentation... but a sort of "inverse lookup" that lists all the common traits and a goal of building intuition for where they're useful would be excellent and prevent the friction from learning by failing.

Realistically I'd guess that many people (self included) aren't even aware of traits that could make their code better, because what we have works good enough so we aren't failing and therefore aren't searching and therefore aren't getting to those docs you mention :slight_smile:

The Rust Book even seemed to recognize this a bit where it mentioned AsRef and compared it to Borrow. Seems pretty clear that pedagogically it's a problem that hasn't been fully dealt with yet.

4 Likes

This sounds like a great idea! Start a repo and make an announcement asking folks to add their favorite trait and I bet you'd get lots of help! Of course it would be nice to have something that integrates with rust-lang/rust, but that's not needed to start working on the content and have something for Google searches to land on.

5 Likes

You may want to use this blog post as a starting point, if @llogiq is fine with that.

(Pretty sure I've seen another one of that kind before, but can't find it right now.)

2 Likes

Of course I'm fine with that! I donated my blog to the public domain for exactly that reason – to signal I'm fine with everyone expanding on it.

3 Likes