I'm confused by the following code (Listing 13-9):
struct Cacher<T>
where
T: Fn(i32) -> i32,
{
calculation: T,
value: Option<i32>,
}
I understand that Fn is a trait, but usually a trait has no argument and returned type. How can I define a trait like Fn?
I tried to look at the definition (actually it's FnOnce, but Fn has FnMut bound and FnMut has FnOnce bound...), but I'm still confused. What is the meaning of that <Args>? Then also something written about it in the Nomicon; but I do not understand it:
Where
Fn(a, b, c) -> dis itself just sugar for the unstable realFntrait