Open
Description
The current wording is pretty confusing and needs refining.
A trait object is an opaque value of another type that implements a set of traits
This suggests a trait object is a value.
For example, given a trait Trait, the following are all trait objects:
- Trait
- dyn Trait
- ...
This suggests "dyn Trait" itself is a trait object.
Syntax TraitObjectType : dyn? TypeParamBounds
This suggests a trait object is a value of type "dyn Trait".
After reading this section, I still don't know which part in
// rfc1909. not exactly sure this is correct.
let reader: dyn Read = File::open(path)?;
is the trait object here. Is it reader
, dyn Read
, or File
?
Metadata
Metadata
Assignees
Labels
No labels