Watch
1
0
Fork
You've already forked advent-of-code
0

Update lib for iterators

This commit is contained in:
Jeremy Kaplan 2022-12-11 14:22:14 -08:00
commit 95875d6d2e
4 changed files with 15 additions and 11 deletions

View file

@ -40,7 +40,7 @@ impl Visibility {
impl Grid {
fn new(text: &str) -> Self {
let mut map = HashMap::new();
let lines = aoc::split_lines(text);
let lines: Vec<&str> = aoc::lines(text).collect();
let rows = lines.len();
let cols = lines[0].len();

View file

@ -43,10 +43,9 @@ struct Step {
}
fn parse_input(input: &str) -> Vec<Step> {
aoc::split_lines(input)
.iter()
aoc::lines(input)
.map(|line| {
let words = aoc::split_words(line);
let words: Vec<&str> = aoc::words(line).collect();
let d = Direction::from_str(words[0]).unwrap();
let n = words[1].parse::<i64>().unwrap();

View file

@ -20,10 +20,9 @@ enum Instruction {
}
fn parse(input: &str) -> Vec<Instruction> {
aoc::split_lines(input)
.iter()
aoc::lines(input)
.map(|line| {
let w = aoc::split_words(line);
let w: Vec<&str> = aoc::words(line).collect();
match w[0] {
"noop" => Instruction::Noop,
"addx" => Instruction::Addx(w[1].parse().unwrap()),