Fn* Traits

51 points kiujhytg2

I've noticed that the Fn* traits take the Arguments as a generic parameter rather than an associated type, i.e.

pub trait Fn<Args> {
    type Output;

    fn call(&self, args: Args) -> Self::Output;
}

not

pub trait Fn {
    type Args;
    type Output;

    fn call(&self, args: Self::Args) -> Self::Output;
}

Which means that crates which deduce information about closures, such as Axum and Bevy require a little magic to allow closures to be passed in. It also implies that a single type can be called with different arguments, as a sort of function overloading, which Rust doesn't have. Is there a reason why this it was chosen to be a generic parameter, or were associated types not a thing when function traits were published and theres' now semver compatability requirements?