Skip to content

Minor fixes to traits post #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 11, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions _posts/2015-05-11-traits.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ static call to the relevant implementation:
```rust
// The compiled code:
__print_hash_bool(&true); // invoke specialized bool version directly
__print_hash_i64(&true); // invoke specialized i64 version directly
__print_hash_i64(&12_i64); // invoke specialized i64 version directly
```

This compilation model isn't so useful for a function like `print_hash`, but
Expand Down Expand Up @@ -348,7 +348,7 @@ wind up playing a few other important roles in Rust. Here's a taste:
method is defined with multiple signatures. But traits provide much of the
benefit of overloading: if a method is defined generically over a trait, it
can be called with any type implementing that trait. Compared to traditional
overloading, this has two advantages. First, it means the overloading is not
overloading, this has two advantages. First, it means the overloading is less
[ad hoc][adhoc]: once you understand a trait, you immediately understand the
overloading pattern of any APIs using it. Second, it is *extensible*: you can
effectively provide new overloads downstream from a method by providing new
Expand Down