Macro for_both
#[macro_export]
macro_rules! for_both {
($value:expr, $pattern:pat => $result:expr) => { ... };
($name:ident => $result:expr) => { ... };
}
Evaluate the provided expression for both Either::Left and Either::Right.
This macro is useful in cases where both sides of Either can be interacted with
in the same way even though the don't share the same type.
Syntax:
either::for_both!(expression,pattern=>expression)either::for_both!(ident=>expression)
Unlike [map_both!], this macro converges both variants to the type returned by the expression.
Example
use Either;
use Either;