I guess the visitor pattern is a nice placeholder for anonymous iterators until we get generators. First saw this in @KodrAus's kv log code. But now also using it for my own work!
pub fn visit(&self, visitor: &mut impl FnMut(&str));
Internally call visit for each item!
-
Show this thread
I've known about the visitor pattern for a while btw. It's just that I've never thought of them as a replacement for anon iterators. The other way around is true too: once anon iters land there's less need for visitors. Only if you need the fn to be executed in the caller contxt
2:14 PM - 27 Jul 2019
0 replies
0 retweets
1 like
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.