How should trait with associated types look in UML?

Hello, can someone give ideas how to draw trait like that in UML?

unsafe trait Foo {
    type Bar: 'static;
    const Baz: i32;
    fn bar(self: Pin<&mut Self>) -> &Self::Bar;
}

In a UML class diagram, I presume? To me, probably the best hack[1] would be to define Bar as an attribute Bar: Type {'static} on the interface that represents the trait in your diagram.


  1. UML 2.5 class diagrams don't have an element that is meant specifically for modelling associated types, so you'll have to repurpose some other element. An attribute with a type Type {constraints} would only be my preference. ↩︎