The version of the call operator that takes a mutable receiver.
Instances of FnMut can be called repeatedly and may mutate state.
FnMut is implemented automatically by closures which take mutable
references to captured variables, as well as all types that implement
Fn, e.g., (safe) function pointers (since FnMut is a supertrait of
Fn). Additionally, for any type F that implements FnMut, &mut F
implements FnMut, too.
Since FnOnce is a supertrait of FnMut, any instance of FnMut can be
used where a FnOnce is expected, and since Fn is a subtrait of
FnMut, any instance of Fn can be used where FnMut is expected.
Use FnMut as a bound when you want to accept a parameter of function-like
type and need to call it repeatedly, while allowing it to mutate state.
If you don’t want the parameter to mutate state, use Fn as a
bound; if you don’t need to call it repeatedly, use FnOnce.
Also of note is the special syntax for Fn traits (e.g.
Fn(usize, bool) -> usize). Those interested in the technical details of
this can refer to the relevant section in the Rustonomicon.
Convert the provided type (generally a closure) to Self (generally a “children” type,
e.g., Children). See the implementations to see exactly which input types are supported
and which “children” type they are converted to.
Convert the provided type (generally a closure) to Self (generally a “children” type,
e.g., Children). See the implementations to see exactly which input types are supported
and which “children” type they are converted to.
Convert the provided type (generally a closure) to Self (generally a “children” type,
e.g., Children). See the implementations to see exactly which input types are supported
and which “children” type they are converted to.
Convert the provided type (generally a closure) to Self (generally a “children” type,
e.g., Children). See the implementations to see exactly which input types are supported
and which “children” type they are converted to.