I would like to nominate `Option::as_deref` for the worst named method in Rust
-
-
Replying to @sgrif
what would you call it? ... i remember being kind of frustrated by how long it was unstable because of that particular bikeshed, and it’s really way nicer than .map(|x| &*x)
2 replies 0 retweets 0 likes -
Replying to @at_tcsc
First preference: `Deref` was just structured in a way it could be implemented by `Option<impl Deref>`. Second preference: Inherent method called `deref` Third+ preference: Something that implies it's *calling* deref on its member, e.g. `derefed`.
2 replies 0 retweets 0 likes -
Replying to @sgrif
how would the first preference work? how do you handle None?
2 replies 0 retweets 0 likes -
Replying to @mountain_ghosts @sgrif
a different signature so you could have Option<A> -> Option<A::Deref>
1 reply 0 retweets 0 likes -
-
-
Replying to @sgrif @mountain_ghosts
is associated types that are generic over only lifetimes easier than GATs that are generic over actual types?
1 reply 0 retweets 1 like
Not really. Most of the complexity of dealing with actual types would come from dealing with lifetimes anyway
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.