Merge pull request #472 from XuGuangnian/patch-2

add trim for Q3 of type-conversions
This commit is contained in:
Sunface
2023-11-02 16:37:49 +08:00
committed by GitHub

View File

@ -61,6 +61,7 @@ impl FromStr for Point {
fn from_str(s: &str) -> Result<Self, Self::Err> { fn from_str(s: &str) -> Result<Self, Self::Err> {
let coords: Vec<&str> = s.trim_matches(|p| p == '(' || p == ')' ) let coords: Vec<&str> = s.trim_matches(|p| p == '(' || p == ')' )
.split(',') .split(',')
.map(|x| x.trim())
.collect(); .collect();
let x_fromstr = coords[0].parse::<i32>()?; let x_fromstr = coords[0].parse::<i32>()?;