You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we implemented the Testable trait for F where F: Fn(A, ...) -> T instead of the concrete fn(A, ...) - T types, it would be possible to just do:
quickcheck(function);
I think this is a usability win, especially with #[quickcheck] unusable under 1.0 (people are likely to be writing quickcheck quite a bit).
I had a quick go at implementing this, but ran into trouble with the Fun trait. I couldn't work out a way to call the function (passed as &self) in a move closure passed to safe. It may be possible, or else more extensive restructuring may be required.
The text was updated successfully, but these errors were encountered:
Even since the introduction of the Fn traits, I've tried to modify quickcheck to use them, but I haven't succeeded yet. As my comment in #56 notes, I think I'm currently blocked on this: rust-lang/rust#25041
At the moment when passing a function to
quickcheck
, its type has to specified:However, bare functions can be passed as generic items implementing
Fn
traits without any casting:If we implemented the
Testable
trait forF where F: Fn(A, ...) -> T
instead of the concretefn(A, ...) - T
types, it would be possible to just do:I think this is a usability win, especially with
#[quickcheck]
unusable under 1.0 (people are likely to be writing quickcheck quite a bit).I had a quick go at implementing this, but ran into trouble with the
Fun
trait. I couldn't work out a way to call the function (passed as&self
) in amove
closure passed tosafe
. It may be possible, or else more extensive restructuring may be required.The text was updated successfully, but these errors were encountered: