right; I was wondering where I hadn't already tripped over this with this impl: impl<T, F> Input<T> for F where F: FnMut() -> T
-
-
-
Replying to @ManishEarth
I guess Fn{,Mut,Once} are special and only implemented for closures, not traits that any other type can implement
2 replies 0 retweets 0 likes -
Replying to @mountain_ghosts
Nope, you can implement them. It's behind a feature flag for ABI reasons but you can implement them.
1 reply 0 retweets 0 likes -
Replying to @ManishEarth @mountain_ghosts
Oh, wait! I misunderstood. You meant that the &mut i64 and FnOnce impl work fine. That's because of #[fundamental]
1 reply 0 retweets 0 likes -
Replying to @ManishEarth @mountain_ghosts
#[fundamental] is what lets you write impls for &T, &mut T, and Box<T> even though they're not from your crate. These three types are fundamental, none others iirc
2 replies 0 retweets 0 likes -
Replying to @ManishEarth
ok but I've also written impls for, in total: - &mut i64 - [T; 1] - &mut Vec<T> - F where F: FnMut() -> T, or F: FnMut(T) - (A, B) where A: Output<T>, B: Output<T>, T: Copy - mpsc::Sender<T>, mpsc::Receiver<T>
2 replies 0 retweets 0 likes -
Replying to @mountain_ghosts
Manish Retweeted Miss Dada 🏳️⚧️
Yeah I was slightly off, this is due to #[fundamental], but it's due to the #[fundamental] on the *trait* FnOncehttps://twitter.com/sgrif/status/1211252386640957441?s=19 …
Manish added,
2 replies 0 retweets 0 likes -
Replying to @ManishEarth @mountain_ghosts
I'm also fairly convinced only like 4 people actually even know and/or can remember how fundamental works. I've seen so many folks think that it somehow makes `T: FnOnce` distinct from `T: OtherTrait`
2 replies 0 retweets 2 likes -
Replying to @sgrif @mountain_ghosts
Pretty much. It's one of those things that you don't really *need* to know even for advanced things, though you may stumble across it while doing advanced things and scratch your head
2 replies 0 retweets 0 likes
I agree. It's just annoying to see uninformed comments on RFCs
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.