This works well:
fn get(data: usize) -> impl Fn(usize) -> bool {
move |i: usize| {
data > i
}
}
But this not because of rfcs/1522-conservative-impl-trait.md at master · rust-lang/rfcs · GitHub
trait Cond {
fn get(&self, data: usize) -> impl Fn(usize) -> bool {
move |i: usize| {
data > i
}
}
}
[E0562] Error: `impl Trait` only allowed in function and inherent method return types, not in trait method return
╭─[command_118:1:1]
│
2 │ fn get(&self, data: usize) -> impl Fn(usize) -> bool {
· ───────────┬──────────
· ╰──────────── error: `impl Trait` only allowed in function and inherent method return types, not in trait method return
───╯
So, is there a inderect way by which I can realize the function of the trait Cond
?