diff options
| author | bors <bors@rust-lang.org> | 2014-05-16 13:11:23 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-05-16 13:11:23 -0700 |
| commit | 5e10686aabb7253e6a6e660e72c7f5de8bbba3de (patch) | |
| tree | c9201890e56ad79f87fdefd95f1f332d91fffa75 /src/doc/tutorial.md | |
| parent | 25c54226c3e7dd6f59cf2e92238a4d79d8b0128d (diff) | |
| parent | b84c0dc2d695c99b64653d125c367fce2ae591c4 (diff) | |
| download | rust-5e10686aabb7253e6a6e660e72c7f5de8bbba3de.tar.gz rust-5e10686aabb7253e6a6e660e72c7f5de8bbba3de.zip | |
auto merge of #14233 : pcwalton/rust/detildestr-morelibs, r=alexcrichton
r? @alexcrichton
Diffstat (limited to 'src/doc/tutorial.md')
| -rw-r--r-- | src/doc/tutorial.md | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/doc/tutorial.md b/src/doc/tutorial.md index 7dd31f9cc77..ad77b90e79b 100644 --- a/src/doc/tutorial.md +++ b/src/doc/tutorial.md @@ -2213,7 +2213,7 @@ don't provide any methods. Traits may be implemented for specific types with [impls]. An impl for a particular trait gives an implementation of the methods that trait provides. For instance, the following impls of -`Printable` for `int` and `~str` give implementations of the `print` +`Printable` for `int` and `StrBuf` give implementations of the `print` method. [impls]: #methods @@ -2224,12 +2224,12 @@ impl Printable for int { fn print(&self) { println!("{:?}", *self) } } -impl Printable for ~str { +impl Printable for StrBuf { fn print(&self) { println!("{}", *self) } } # 1.print(); -# ("foo".to_owned()).print(); +# ("foo".to_strbuf()).print(); ~~~~ Methods defined in an impl for a trait may be called just like @@ -2270,7 +2270,7 @@ trait Printable { impl Printable for int {} -impl Printable for ~str { +impl Printable for StrBuf { fn print(&self) { println!("{}", *self) } } @@ -2279,7 +2279,7 @@ impl Printable for bool {} impl Printable for f32 {} # 1.print(); -# ("foo".to_owned()).print(); +# ("foo".to_strbuf()).print(); # true.print(); # 3.14159.print(); ~~~~ @@ -2291,7 +2291,7 @@ provided in the trait definition. Depending on the trait, default methods can save a great deal of boilerplate code from having to be written in impls. Of course, individual impls can still override the default method for `print`, as is being done above in the impl for -`~str`. +`StrBuf`. ## Type-parameterized traits |
