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