aoc prelude
This commit is contained in:
parent
34629ee970
commit
c18cfa45a4
4 changed files with 10 additions and 3 deletions
2
2022/Cargo.lock
generated
2
2022/Cargo.lock
generated
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "aoc2022"
|
||||
name = "aoc"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
|
|
|
|||
|
|
@ -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
7
2022/src/lib.rs
Normal 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()
|
||||
}
|
||||
Loading…
Reference in a new issue