whichever 0.7.1

Implements a trait for an enum by forwarding to whichever variant it holds
Documentation
use std::future::IntoFuture;

#[whichever::dispatchable]
trait Fetch {
    fn fetch(&self) -> impl IntoFuture<Output = u32>;
}

struct Memory;

impl Fetch for Memory {
    fn fetch(&self) -> impl IntoFuture<Output = u32> {
        async { 1 }
    }
}

#[whichever::dispatch(Fetch)]
enum Source {
    Memory(Memory),
}

fn main() {}