use cool_trais::Foo; use ridicule::predicate::{always, eq}; use crate::cool_trais::MockFoo; pub trait DoStuff {} impl DoStuff for f32 {} mod cool_trais { use ridicule::automock; use crate::DoStuff; #[automock] pub trait Foo: Sized { fn bar(&self, num: u128, text: &str) -> Something where Something: DoStuff; } } fn main() { let mut mock_foo = MockFoo::new(); mock_foo .expect_bar() .with(eq(1234), always()) .returning(|_, num, text| { println!("bar was called with {num} and '{text}'"); 9.36f32 }); mock_foo.bar::(1234, "Hello"); }