File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -43,28 +43,28 @@ pub mod pattern;
43
43
/// ```
44
44
/// use std::str::FromStr;
45
45
/// use std::num::ParseIntError;
46
- ///
46
+ ///
47
47
/// #[derive(Debug, PartialEq)]
48
48
/// struct Point {
49
49
/// x: i32,
50
50
/// y: i32
51
51
/// }
52
- ///
52
+ ///
53
53
/// impl FromStr for Point {
54
54
/// type Err = ParseIntError;
55
- ///
55
+ ///
56
56
/// fn from_str(s: &str) -> Result<Self, Self::Err> {
57
57
/// let coords: Vec<&str> = s.trim_matches(|p| p == '(' || p == ')' )
58
58
/// .split(",")
59
59
/// .collect();
60
- ///
60
+ ///
61
61
/// let x_fromstr = try!(coords[0].parse::<i32>());
62
62
/// let y_fromstr = try!(coords[1].parse::<i32>());
63
- ///
63
+ ///
64
64
/// Ok(Point { x: x_fromstr, y: y_fromstr })
65
65
/// }
66
66
/// }
67
- ///
67
+ ///
68
68
/// let p = Point::from_str("(1,2)");
69
69
/// assert_eq!(p.unwrap(), Point{ x: 1, y: 2} )
70
70
/// ```
You can’t perform that action at this time.
0 commit comments