mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-01-20 21:18:26 +02:00
Update traits.md
This commit is contained in:
parent
100ee591ed
commit
330d21ef02
@ -41,7 +41,7 @@ fn main() {
|
||||
* Traits may specify pre-implemented (default) methods and methods that users are required to implement themselves. Methods with default implementations can rely on required methods.
|
||||
* Types that implement a given trait may be of different sizes. This makes it impossible to have things like `Vec<Greet>` in the example above.
|
||||
* `dyn Greet` is a way to tell the compiler about a dynamically sized type that implements `Greet`.
|
||||
* In the example, `pets` holds Fat Pointers to objects that implement `Greet`. The Fat Pointer consist of two components, a pointer to the actual object and a pointer to the virtual method table for the `Greet` implementation of that particular object.
|
||||
* In the example, `pets` holds Fat Pointers to objects that implement `Greet`. The Fat Pointer consists of two components, a pointer to the actual object and a pointer to the virtual method table for the `Greet` implementation of that particular object.
|
||||
|
||||
Compare these outputs in the above example:
|
||||
```rust,ignore
|
||||
|
Loading…
x
Reference in New Issue
Block a user