Macro easy_conv::chained_into
source · macro_rules! chained_into { ($source: ty, $($tail: ty),+) => { ... }; (@impl $source: ty | $($intermediate: ty),* | $target: ty) => { ... }; (@get_target $target: ty) => { ... }; (@get_target $_: ty, $($tail: ty),+) => { ... }; (@next $val: expr, $intermediate: ty) => { ... }; (@next $val: expr, $intermediate: ty, $($tail: ty),+) => { ... }; }
Expand description
Implement conversion from A to Z via B, C, …
B needs to implement From<A>, C needs to implement From<B>, and so on.
Example: chained_into!(A, B, C, D, E); implements From<A> for E by
converting A to B, then B to C, then C to D, and finally D to E.