Hello, what you think about this
impl<A, B> (Option<A>, Option<B>) {
fn zip(&self) -> Option<(&A, &B)> {
self.0.as_ref().zip(self.1.as_ref())
}
}
This is an alternative syntax for Option::zip
for situation where you have a variable that represents a pair of Optionals and you want to combine them without doing
let (a, b) = pair;
let Some((l, r)) = a.zip(b) else { ... };
instead one could just do
let Some((l, r)) = pair.zip() else { ... };