Call consuming method for dyn trait object?

You can use Box<Self> as the receiver type for the trait method:

trait Trait {
    fn consume(self: Box<Self>);
}

(Playground)

5 Likes