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

aoc prelude

This commit is contained in:
Jeremy Kaplan 2022-12-07 23:05:00 -08:00
commit c18cfa45a4
4 changed files with 10 additions and 3 deletions

2
2022/Cargo.lock generated
View file

@ -18,7 +18,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6"
[[package]]
name = "aoc2022"
name = "aoc"
version = "0.1.0"
dependencies = [
"anyhow",

View file

@ -1,5 +1,5 @@
[package]
name = "aoc2022"
name = "aoc"
version = "0.1.0"
edition = "2021"

View file

@ -5,7 +5,7 @@ fn main() {
}
fn part1(input: &str) -> usize {
for line in input.split('\n').filter(|l| !l.is_empty()) {
for line in aoc.split_lines(input) {
todo!()
}
}

7
2022/src/lib.rs Normal file
View file

@ -0,0 +1,7 @@
pub fn split_lines(s: &str) -> Vec<&str> {
s.trim_end().split('\n').collect()
}
pub fn split_words(s: &str) -> Vec<&str> {
s.split(' ').collect()
}