Just following along in the textbook for now.
Went with what I know, which is axum, but tower uses
`use http_body_util::{BodyExt, Empty, Full};`, and I
should plan on moving to that before I get too deep
into the guts of this thing.
This commit is contained in:
parent
876371b09f
commit
47cae5dada
|
|
@ -0,0 +1,11 @@
|
|||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
debug
|
||||
target
|
||||
|
||||
# These are backup files generated by rustfmt
|
||||
**/*.rs.bk
|
||||
|
||||
# rustc will dump stack traces when hitting an internal compiler error to PWD
|
||||
rustc-ice-*.txt
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,6 @@
|
|||
[workspace]
|
||||
members = ["serve_zip", "demo"]
|
||||
|
||||
# Apparently, you can't just set `edition="2021"` here and get the new resolver automatically.
|
||||
# See https://doc.rust-lang.org/edition-guide/rust-2021/default-cargo-resolver.html
|
||||
resolver = "2"
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
[package]
|
||||
name = "demo"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
axum = "0.8.9"
|
||||
clap = { version = "4.6.1", features = ["derive"] }
|
||||
tokio = { version = "1.52.3", features = ["full"] }
|
||||
tower-http = { version = "0.6.10", features = ["trace"] }
|
||||
tracing-subscriber = "0.3.23"
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
[package]
|
||||
name = "serve_zip"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
|
||||
# Not sure this is the right approach. The _demo_ points to axum, but serve_dir uses http-body-util
|
||||
axum = { version = "0.8.9", features = ["http1", "tokio"] }
|
||||
|
||||
futures-util = "0.3.32"
|
||||
|
||||
http = "1.4.0"
|
||||
|
||||
mime_guess = "2.0.5"
|
||||
|
||||
rc-zip-tokio = "4.3.1"
|
||||
|
||||
tokio = { version = "1.52.3", features = ["full"] }
|
||||
|
||||
tokio-util = { version = "0.7.18", features = ["io"] }
|
||||
|
||||
tower = { version = "0.5.3", features = ["util"] }
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
pub fn add(left: u64, right: u64) -> u64 {
|
||||
left + right
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn it_works() {
|
||||
let result = add(2, 2);
|
||||
assert_eq!(result, 4);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue