Even though this is perhaps a really minor detail, I was wondering whether the following type signature I had previously written, was the better choice of two potential options, whether in terms of brevity, performance, or pragmatics:
These are implementation details within a (currently hidden) module of a crate I am working on, so even though it would be marked pub in either case, neither version would be directly user-facing, if that makes any difference.
Original:
pub struct Iter<'a>(
std::iter::Copied<
std::iter::Chain<std::slice::Iter<'a, usize>, std::option::Iter<'a, usize>>>,
);
Is it somehow more natural to write it as the following:
pub struct Iter<'a>(
std::iter::Chain<
std::iter::Copied<std::slice::Iter<'a, usize>>,
std::iter::Copied<std::option::Iter<'a, usize>>>,
);
tl;dr: should one distribute std::iter::Copied or other unary combinators, or wrap around std::iter::Chain and other binary combinators?