whichever 0.7.1

Implements a trait for an enum by forwarding to whichever variant it holds
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
struct Celsius(f64);

impl std::fmt::Display for Celsius {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{} C", self.0)
    }
}

#[whichever::dispatch(std::fmt::Display)]
enum Temperature {
    Celsius(Celsius),
}

fn main() {}