"Plus" sign in trait and type definitions


#1

Sometimes I see code written like

pub trait name: Clone + Eq + Ord + Hash + Serialize + Debug {...}

or

pub trait abc {
    type one: TwoType + ThreeType;
...
}

can someone explain what this mean, or give the appropriate chapter in the reference manual. I might have overlooked it. Also after I know what this is I might change the topic headline.


#2

These are not types, but trait bounds. The plus sign allows you to combine multiple requirements in a trait bound. type OneType: TwoTrait + ThreeTrait means that the OneType associated type must implement both TwoTrait and ThreeTrait traits.

The Trait bounds section in the book explains this feature.


#3

Ah, I see. Thanks.