Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pub struct Struct {}
- pub trait Trait<'a> {
- type Assoc;
- fn method() -> Self::Assoc;
- }
- impl<'a> Trait<'a> for Struct {
- type Assoc = ();
- fn method() -> Self::Assoc {}
- }
- pub fn function<F, T>(f: F)
- where
- F: for<'a> FnOnce(<T as Trait<'a>>::Assoc),
- T: for<'b> Trait<'b>,
- {
- f(T::method());
- }
- fn main() {
- function::<_, Struct>(|_| {});
- }
Add Comment
Please, Sign In to add comment