Skip to content

Commit

Permalink
tutorial: change float to f32 since float is no longer a type.
Browse files Browse the repository at this point in the history
  • Loading branch information
lkuper committed Jan 6, 2014
1 parent 5681c71 commit 60e1394
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions doc/tutorial.md
Expand Up @@ -2184,12 +2184,12 @@ any other method, using dot notation, as in `1.print()`.

Sometimes, a method that a trait provides will have the same
implementation for most or all of the types that implement that trait.
For instance, suppose that we wanted `bool`s and `float`s to be
For instance, suppose that we wanted `bool`s and `f32`s to be
printable, and that we wanted the implementation of `print` for those
types to be exactly as it is for `int`, above:

~~~~
impl Printable for float {
impl Printable for f32 {
fn print(&self) { println!("{:?}", *self) }
}
Expand Down Expand Up @@ -2220,15 +2220,15 @@ impl Printable for ~str {
impl Printable for bool {}
impl Printable for float {}
impl Printable for f32 {}
# 1.print();
# (~"foo").print();
# true.print();
# 3.14159.print();
~~~~

Here, the impls of `Printable` for `int`, `bool`, and `float` don't
Here, the impls of `Printable` for `int`, `bool`, and `f32` don't
need to provide an implementation of `print`, because in the absence
of a specific implementation, Rust just uses the _default method_
provided in the trait definition. Depending on the trait, default
Expand Down

0 comments on commit 60e1394

Please sign in to comment.