@@ -498,6 +498,10 @@ Because captures are often by reference, the following general rules arise:
498
498
499
499
## Trait objects
500
500
501
+ > ** <sup >Syntax</sup >**
502
+ > _ TraitObjectType_ :
503
+ >   ;  ; [ _ Path_ ] ( ` + ` [ _ Path_ ] )<sup >\* </sup > ` + ` <sup >?</sup >
504
+
501
505
A * trait object* is an opaque value of another type that implements a set of
502
506
traits. The set of traits is made up of an [ object safe] * base trait* plus any
503
507
number of [ auto traits] .
@@ -506,10 +510,10 @@ Trait objects implement the base trait, its auto traits, and any super traits
506
510
of the base trait.
507
511
508
512
Trait objects are written as the path to the base trait followed by the list
509
- of auto traits followed optionally by a lifetime bound all separated by ` + ` . For
510
- example, given a trait ` Trait ` , the following are all trait objects: ` Trait ` ,
511
- ` Trait + Send ` , ` Trait + Send + Sync ` , ` Trait + 'static ` ,
512
- ` Trait + Send + 'static ` .
513
+ of auto traits followed optionally by a lifetime bound all separated by and
514
+ optionally terminated by ` + ` . For example, given a trait ` Trait ` , the following
515
+ are all trait objects: ` Trait ` , ` Trait + Send ` , ` Trait + Send + Sync ` ,
516
+ ` Trait + 'static ` , ` Trait + Send + 'static` , ` Trait + ` .
513
517
514
518
Two trait object types alias each other if the base traits alias each other and
515
519
if the sets of auto traits are the same and the lifetime bounds are the same.
@@ -701,3 +705,4 @@ impl Printable for String {
701
705
[ object safe ] : items/traits.html#object-safety
702
706
[ issue 47010 ] : https://github.com/rust-lang/rust/issues/47010
703
707
[ issue 33140 ] : https://github.com/rust-lang/rust/issues/33140
708
+ [ _PATH_ ] : paths.html
0 commit comments