]>
Commit | Line | Data |
---|---|---|
c30ab7b3 | 1 | #![crate_name = "foo"] |
9e0c209e | 2 | |
476ff2be SL |
3 | use std::ops::Add; |
4 | use std::fmt::Display; | |
5 | ||
c30ab7b3 SL |
6 | //@count foo/fn.function_with_a_really_long_name.html //pre/br 2 |
7 | pub fn function_with_a_really_long_name(parameter_one: i32, | |
8 | parameter_two: i32) | |
9 | -> Option<i32> { | |
10 | Some(parameter_one + parameter_two) | |
223e47cc | 11 | } |
c30ab7b3 SL |
12 | |
13 | //@count foo/fn.short_name.html //pre/br 0 | |
14 | pub fn short_name(param: i32) -> i32 { param + 1 } | |
476ff2be SL |
15 | |
16 | //@count foo/fn.where_clause.html //pre/br 4 | |
17 | pub fn where_clause<T, U>(param_one: T, | |
18 | param_two: U) | |
19 | where T: Add<U> + Display + Copy, | |
20 | U: Add<T> + Display + Copy, | |
21 | T::Output: Display + Add<U::Output> + Copy, | |
22 | <T::Output as Add<U::Output>>::Output: Display, | |
23 | U::Output: Display + Copy | |
24 | { | |
25 | let x = param_one + param_two; | |
26 | println!("{} + {} = {}", param_one, param_two, x); | |
27 | let y = param_two + param_one; | |
28 | println!("{} + {} = {}", param_two, param_one, y); | |
29 | println!("{} + {} = {}", x, y, x + y); | |
30 | } |