Rust template

This commit is contained in:
Tobias Berger 2020-11-06 16:27:11 +01:00 committed by Tobias Berger
commit 8384c6406d
Signed by: toby
GPG key ID: 2D05EFAB764D6A88
9 changed files with 93 additions and 0 deletions

1
rust/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/target

2
rust/.helix/config.toml Normal file
View file

@ -0,0 +1,2 @@
[editor.file-picker]
git-ignore = true

7
rust/Cargo.lock generated Normal file
View file

@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "advent-of-code"
version = "23.0.0"

24
rust/Cargo.toml Normal file
View file

@ -0,0 +1,24 @@
[package]
name = "advent-of-code"
version = "23.0.0"
[profile.release]
strip = "symbols"
lto = true
opt-level = 3
codegen-units = 1
[profile.dev.package."*"]
opt-level = 3
codegen-units = 1
[profile.release.package."*"]
opt-level = 3
codegen-units = 1
[profile.release.build-override]
codegen-units = 1
[[bin]]
name = "template"
# day00 for alphabetic sorting
path = "src/day00/main.rs"
test = false

0
rust/src/day00/input.txt Normal file
View file

11
rust/src/day00/main.rs Normal file
View file

@ -0,0 +1,11 @@
const INPUT: &str = include_str!("input.txt");
mod part_1;
use part_1::part_1;
mod part_2;
use part_2::part_2;
fn main() {
println!("{}", part_1(INPUT));
println!("{}", part_2(INPUT));
}

24
rust/src/day00/part_1.rs Normal file
View file

@ -0,0 +1,24 @@
pub(crate) fn part_1(_input: &'static str) -> u64 {
todo!("Part 1")
}
#[cfg(test)]
mod tests {
const SAMPLE_INPUT: &str = include_str!("sample_input.txt");
#[test]
fn test_with_sample_solution() {
assert_eq!(
super::part_1(SAMPLE_INPUT),
todo!("Add result from example part 1")
)
}
#[test]
fn test_with_solution() {
assert_eq!(
super::part_1(crate::INPUT),
todo!("Add result for solved part 1")
);
}
}

24
rust/src/day00/part_2.rs Normal file
View file

@ -0,0 +1,24 @@
pub(crate) fn part_2(_input: &'static str) -> u64 {
todo!("Part 2")
}
#[cfg(test)]
mod tests {
const SAMPLE_INPUT: &str = include_str!("sample_input.txt");
#[test]
fn test_with_sample_solution() {
assert_eq!(
super::part_2(SAMPLE_INPUT),
todo!("Add result from example part 2")
);
}
#[test]
fn test_with_solution() {
assert_eq!(
super::part_2(crate::INPUT),
todo!("Add result for solved part 2")
);
}
}

View file