···1+# Doesn't work in the sandbox
2+[yanked]
3+enabled = false # Warn for yanked crates in Cargo.lock (default: true)
4+update_index = false # Auto-update the crates.io index (default: true)
+24
.config/hakari.toml
···000000000000000000000000
···1+# This file contains settings for `cargo hakari`.
2+# See https://docs.rs/cargo-hakari/latest/cargo_hakari/config for a full list of options.
3+4+hakari-package = "my-workspace-hack"
5+6+# Format version for hakari's output. Version 4 requires cargo-hakari 0.9.22 or above.
7+dep-format-version = "4"
8+9+# Setting workspace.resolver = "2" in the root Cargo.toml is HIGHLY recommended.
10+# Hakari works much better with the new feature resolver.
11+# For more about the new feature resolver, see:
12+# https://blog.rust-lang.org/2021/03/25/Rust-1.51.0.html#cargos-new-feature-resolver
13+resolver = "2"
14+15+# Add triples corresponding to platforms commonly used by developers here.
16+# https://doc.rust-lang.org/rustc/platform-support.html
17+platforms = [
18+ # "x86_64-unknown-linux-gnu",
19+ # "x86_64-apple-darwin",
20+ # "x86_64-pc-windows-msvc",
21+]
22+23+# Write out exact versions rather than a semver range. (Defaults to false.)
24+# exact-versions = true
···1+[workspace]
2+resolver = "2"
3+# Note that we define member crates with a wildcard here and NOT with explicit
4+# paths because the flake.nix is written in a way such that top-level members
5+# (`my-cli` and `my-server`) are built as different derivations which avoid being
6+# rebuilt if the other package's sources change.
7+members = ["crates/*"]
8+9+[workspace.package]
10+version = "0.1.0"
11+edition = "2021"
12+13+[workspace.metadata.crane]
14+name = "atpblog-workspace"
···1+//! An HTTP server which will echo back query params sent to /ping
2+3+use axum::{extract::Query, response::Html, routing::get, Router};
4+use std::collections::HashMap;
5+6+#[tokio::main]
7+async fn main() {
8+ let app = Router::new()
9+ .route("/", get(handler))
10+ .route("/ping", get(ping));
11+12+ let listener = tokio::net::TcpListener::bind("127.0.0.1:3000")
13+ .await
14+ .unwrap();
15+ println!("listening on {}", listener.local_addr().unwrap());
16+ axum::serve(listener, app).await.unwrap();
17+}
18+19+async fn handler() -> Html<&'static str> {
20+ Html("<h1>Hello, World!</h1>")
21+}
22+23+async fn ping(Query(params): Query<HashMap<String, String>>) -> Html<String> {
24+ let (tx, mut rx, fut) = my_common::echo_task(10, "ping".into());
25+ tokio::spawn(fut);
26+ tokio::spawn(async move {
27+ for (k, v) in params {
28+ if tx.send(format!("{k}: {v}").into()).await.is_err() {
29+ break;
30+ }
31+ }
32+ });
33+34+ let mut body = String::from("<pre>");
35+36+ while let Some(msg) = rx.recv().await {
37+ body.push_str(&msg);
38+ }
39+40+ body.push_str("</pre>");
41+ Html(body)
42+}
+4
crates/atpblog-workspace-hack/.gitattributes
···0000
···1+# Avoid putting conflict markers in the generated Cargo.toml file, since their presence breaks
2+# Cargo.
3+# Also do not check out the file as CRLF on Windows, as that's what hakari needs.
4+Cargo.toml merge=binary -crlf
+25
crates/atpblog-workspace-hack/Cargo.toml
···0000000000000000000000000
···1+# This file is generated by `cargo hakari`.
2+# To regenerate, run:
3+# cargo hakari generate
4+5+[package]
6+name = "atpblog-workspace-hack"
7+version = "0.1.0"
8+description = "workspace-hack package, managed by hakari"
9+# You can choose to publish this crate: see https://docs.rs/cargo-hakari/latest/cargo_hakari/publishing.
10+publish = false
11+12+# The parts of the file between the BEGIN HAKARI SECTION and END HAKARI SECTION comments
13+# are managed by hakari.
14+15+### BEGIN HAKARI SECTION
16+[dependencies]
17+smallvec = { version = "1", default-features = false, features = ["const_new"] }
18+tokio = { version = "1", features = ["full"] }
19+20+[build-dependencies]
21+proc-macro2 = { version = "1" }
22+quote = { version = "1" }
23+syn = { version = "2", features = ["full", "visit-mut"] }
24+25+### END HAKARI SECTION
+2
crates/atpblog-workspace-hack/build.rs
···00
···1+// A build script is required for cargo to consider build dependencies.
2+fn main() {}