-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trait support? #54
Comments
pub trait A{ struct MockA{} //i will define a struct #[cfg_attr(test, faux::create)] / let a = MockA::faux() |
This is definitely something I want to do, but I haven't prioritized it yet. The hardest part is coming up with something ergonomic that works for all traits. My ideal solution would be something like: #[cfg_attr(test, faux::create)]
pub trait MyTrait {
/* declare methods */
}
#[test]
fn my_test() {
let mock = MyTrait::faux();
} But rust only allows calling instance methods directly on traits for object safe traits which means it is not a global solution. Maybe I'll just have to say that it's good enough and provide a fallback for non-object safe traits? I am not sure... these design decisions slow me down haha |
It looks like there's been code to support what I want in nightly for over 3 years but it has yet to be stabilized: rust-lang/rust#43561. There hasn't been any discussion on the tracking issue in a while though so it's hard to know if it's going to be merged soon or if it got lost in the shuffle. |
good library.!!!!!!!!!
is there plan to support trait ?
The text was updated successfully, but these errors were encountered: