dynamic-provider 0.1.2

Dynamically request arbitrarily-typed values from providers with borrowed data.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
```rust
use dynamic_provider::{when_provider, ProvideRef};

dynamic_provider::define_tag! {
    tag Details: for<'x> (&'x str, &'x str);
}

fn get_details(provider: &dyn ProvideRef) -> String {
    when_provider(provider)
        .has_value::<String>(|s| s)
        .has_ref::<str>(|s| s.into())
        .has::<Details>((), |(a, b)| format!("{a}, {b}"))
        .or_else(|_| "unknown".into())
}
```