External Publication
Visit Post

Closures and functional traits

Rust Internals [Unofficial] February 5, 2026
Source

The Fn* family of traits does not express everything that can be expressed with a trait with one method. For example, you can define a trait with a generic method:

trait Foo {
    fn foo<T>(&mut self, things: &mut [T]);
}

It’s impossible to express this as a usage of FnMut or to implement this using a from_fn()-style adapter.

Discussion in the ATmosphere

Loading comments...