mirror of
https://github.com/Ajetski/advent-of-code.git
synced 2025-09-30 07:03:19 -09:00
fix error type for parsing
This commit is contained in:
parent
28119de098
commit
bd3d47f442
@ -173,12 +173,12 @@ impl std::hash::Hash for Tile {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl std::str::FromStr for Tile {
|
impl std::str::FromStr for Tile {
|
||||||
type Err = std::string::ParseError;
|
type Err = std::num::ParseIntError;
|
||||||
|
|
||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
let (id_line, grid_lines) = s.split_once('\n').unwrap();
|
let (id_line, grid_lines) = s.split_once('\n').unwrap();
|
||||||
Ok(Tile {
|
Ok(Tile {
|
||||||
id: id_line[5..id_line.chars().count() - 1].parse().unwrap(),
|
id: id_line[5..id_line.chars().count() - 1].parse()?,
|
||||||
grid: grid_lines
|
grid: grid_lines
|
||||||
.trim()
|
.trim()
|
||||||
.split('\n')
|
.split('\n')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user