From 3af4a44096cad5a50592abe77921ec400f31af6d Mon Sep 17 00:00:00 2001 From: omagdy7 Date: Thu, 7 Dec 2023 02:07:47 +0200 Subject: Renamed some structs --- 2023/Rust/src/day6.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to '2023') diff --git a/2023/Rust/src/day6.rs b/2023/Rust/src/day6.rs index 68996b6..22f98ff 100644 --- a/2023/Rust/src/day6.rs +++ b/2023/Rust/src/day6.rs @@ -1,16 +1,16 @@ -use std::{collections::HashMap, marker::PhantomData}; +use std::marker::PhantomData; #[derive(Debug)] -struct Race { +struct Race { times: Vec, distances: Vec, - state: std::marker::PhantomData, + state: std::marker::PhantomData, } -struct Part1; -struct Part2; +struct One; +struct Two; -impl From<&str> for Race { +impl From<&str> for Race { fn from(value: &str) -> Self { let (times, distances) = value.split_once("\n").unwrap(); let (_, times) = times.split_once(':').unwrap(); @@ -26,12 +26,12 @@ impl From<&str> for Race { Self { times, distances, - state: PhantomData::, + state: PhantomData::, } } } -impl From<&str> for Race { +impl From<&str> for Race { fn from(value: &str) -> Self { let (times, distances) = value.split_once("\n").unwrap(); let (_, times) = times.split_once(':').unwrap(); @@ -51,7 +51,7 @@ impl From<&str> for Race { Self { times: vec![times], distances: vec![distances], - state: PhantomData::, + state: PhantomData::, } } } @@ -65,7 +65,7 @@ fn quadratic_equation(a: f64, b: f64, c: f64) -> (f64, f64) { } fn solve_math_two(data: &str) -> u64 { - let race: Race = Race::from(data); + let race: Race = Race::from(data); race.times .iter() .zip(race.distances.iter()) @@ -77,7 +77,7 @@ fn solve_math_two(data: &str) -> u64 { } fn solve_math_one(data: &str) -> u64 { - let race: Race = Race::from(data); + let race: Race = Race::from(data); race.times .iter() .zip(race.distances.iter()) @@ -89,7 +89,7 @@ fn solve_math_one(data: &str) -> u64 { } fn solve_part_one(data: &str) -> u64 { - let race: Race = Race::from(data); + let race: Race = Race::from(data); race.times .iter() .zip(race.distances.iter()) @@ -103,7 +103,7 @@ fn solve_part_one(data: &str) -> u64 { .product::() as u64 } fn solve_part_two(data: &str) -> u64 { - let race: Race = Race::from(data); + let race: Race = Race::from(data); race.times .iter() .zip(race.distances.iter()) -- cgit v1.2.3