Skip to content

Commit 24ba60d

Browse files
committed
added day 19
1 parent 58e976a commit 24ba60d

File tree

10 files changed

+245
-0
lines changed

10 files changed

+245
-0
lines changed

Cargo.lock

Lines changed: 171 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
[workspace]
22
members = ["crates/*/*"]
3+
4+
exclude = ["crates/day-19/project"]

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,10 @@ These examples require setting an environment variable. How to do that in your e
135135
- `cargo run -p day-18-async --bin lazy`
136136
- `cargo run -p day-18-async --bin fs`
137137
- `cargo run -p day-18-async --bin async-blocks`
138+
139+
### Day 19
140+
141+
First you must cd into `crates/day-19`
142+
143+
- `cargo test`
144+
- `cargo run -p cli`

crates/day-19/project/Cargo.lock

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/day-19/project/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[workspace]
2+
members = ["crates/*"]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[package]
2+
name = "cli"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
8+
[dependencies]
9+
my-lib = { path = "../my-lib" }
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
use my_lib::Module;
2+
3+
fn main() {
4+
match Module::from_file("./module.wasm") {
5+
Ok(_) => {
6+
println!("Module loaded");
7+
}
8+
Err(e) => {
9+
println!("Module failed to load: {}", e);
10+
}
11+
}
12+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/target
2+
Cargo.lock
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[package]
2+
name = "my-lib"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
8+
[dependencies]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
use std::path::Path;
2+
pub struct Module {}
3+
4+
impl Module {
5+
pub fn from_file<T: AsRef<Path>>(path: T) -> Result<Self, std::io::Error> {
6+
Ok(Self {})
7+
}
8+
}
9+
10+
#[cfg(test)]
11+
mod tests {
12+
use super::*;
13+
#[test]
14+
fn loads_wasm_file() {
15+
let result = Module::from_file("./tests/test.wasm");
16+
assert!(result.is_ok());
17+
}
18+
}

0 commit comments

Comments
 (0)