Pls explain it with a little example
If you have a bound on the method of a trait, and an implementer of the trait does not meet that bound, the method does not exist for that type. But the trait can still be implemented: playground example.
dyn Trait aka trait objects are dynamically sized types (DSTs). This means that they don't implement the
Sized trait (which is why they are generally behind some kind of pointer like
&dyn Trait or
Since the method doesn't exist for types that are not
Sized, and this includes
dyn Trait, the method need note be considered as part of the object safety checks.
Corollary: You can't use those methods from your
dyn Trait, though.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.