use supply::prelude::*; use supply::request::Req3; struct Demo { a: u8, b: f32, c: bool, } impl<'r> Provider<'r> for Demo { type Lifetimes = l![]; fn provide(&'r self, want: &mut dyn Want) { // provide_value can be chained. want.provide_value(self.a) .provide_value(self.b) .provide_value(self.c); } } #[test] fn example() { let demo = Demo { a: 3, b: 7.8, c: true, }; // Request a bool, u8, and f32 from demo. let Req3(bool, num, float) = demo.request::>(); // We see its the same data as we put in demo. assert_eq!(num, Some(3)); assert_eq!(float, Some(7.8)); assert_eq!(bool, Some(true)); }