Impl Trait item blocks & associated methods for traits

So defining a trait is nothing new:

trait Foo { 
  fn foo() {
    // omitted
  }
}

However this confuses me:

impl Foo {
  fn some_other_foo() {
    // omitted
  }
}

Other than w.r.t. object safety (which isn’t illustrated here, but is one place where I can see the usefulness), why are impl Trait items even allowed?
Or, to paraphrase, what does it allow for that a default fn in the trait item itself does not?

It is a bit more clearer if your write;
impl dyn Foo {
i.e. defining functions on the trait object.

Very few uses, here is one example.

2 Likes