use std::fmt::Display; use ridicule::mock; trait Foo { fn bar(&self, something: &Something); } mock! { MockFoo {} impl Foo for MockFoo { fn bar(&self, something: &Something); } } fn main() { let mut mock_foo = MockFoo::new(); unsafe { mock_foo.expect_bar().returning(|_me, something: &f32| { println!("bar was called with {something}"); }); } unsafe { mock_foo.expect_bar().returning(|_me, something: &f64| { println!("bar was called with {something}"); }); } mock_foo.bar(&0.826f32); mock_foo.bar(&0.410f64); }