easytime 0.2.8

Providing wrapper types for safely performing panic-free checked arithmetic on instants and durations.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
// SPDX-License-Identifier: Apache-2.0 OR MIT

#[inline]
pub(crate) fn pair_and_then<A, B, C, F>(x: Option<A>, y: Option<B>, f: F) -> Option<C>
where
    F: FnOnce(A, B) -> Option<C>,
{
    match (x, y) {
        (Some(x), Some(y)) => f(x, y),
        _ => None,
    }
}