Like Option::unzip
, the origin code:
impl<T, U> Option<(T, U)> {
pub fn unzip(self) -> (Option<T>, Option<U>) {
match self {
Some((a, b)) => (Some(a), Some(b)),
None => (None, None),
}
}
}
But different in bound, my idea:
impl<T, U> Option<&(T, U)> {
pub fn unzip_ref(self) -> (Option<&T>, Option<&U>) {
match self {
Some((a, b)) => (Some(a), Some(b)),
None => (None, None),
}
}
}