I'm stuck with the above error message in this code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=280a52f4dc63204e7bb23bcfe8521e76
I'm using map on option for convenience. Somehow, the error has to do with the fact that secondary_node is captured in the closure. Without a closure (commented out code below), the same code works ok.
Is there a pattern that I have to use to make this work?