-
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
Does not support associated types #57
Comments
Hmm this is a little tricky. To be specific though As a workaround you could get away with using The reason why this is tricky is a bit complex but I am going to try to explain it as a reference to myself in the future (or if you're interested in submitting a PR for it ofc you'd be welcome to). When you have a function like: fn method<A>(&self, data: impl IntoIterator<Item = A>) {} Rust will under the hood desugar it to something like: fn method<A, I>(&self, data: impl IntoIterator<Item = A, IntoIter=I>) {} Which means that there is a hidden generic there (
Specifying the associated type is actually not that hard, it just means adding a generic in some internal function that Maybe something like: #[cfg_attr(test, faux::methods)]
// specifies all associated types of `IntoIterator` so `faux` knows about them.
#[cfg_attr(test, faux(hint = "IntoIterator<type Item, type IntoIter>"))]
impl Object {
pub fn method<A>(&self, data: impl IntoIterator<Item = A>) {}
} But that's just my first idea off the top of my head so I may need to chew on it more to see if i can think of a better UX for this, but something does need to be explicitly given to |
Error is
The text was updated successfully, but these errors were encountered: