init with crane workspace flake template

+1172
+4
.cargo/audit.toml
··· 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
··· 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
+6
.gitignore
··· 1 + /target 2 + result* 3 + 4 + .direnv 5 + .env 6 + .devenv
+727
Cargo.lock
··· 1 + # This file is automatically @generated by Cargo. 2 + # It is not intended for manual editing. 3 + version = 4 4 + 5 + [[package]] 6 + name = "addr2line" 7 + version = "0.24.2" 8 + source = "registry+https://github.com/rust-lang/crates.io-index" 9 + checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" 10 + dependencies = [ 11 + "gimli", 12 + ] 13 + 14 + [[package]] 15 + name = "adler2" 16 + version = "2.0.0" 17 + source = "registry+https://github.com/rust-lang/crates.io-index" 18 + checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" 19 + 20 + [[package]] 21 + name = "async-trait" 22 + version = "0.1.83" 23 + source = "registry+https://github.com/rust-lang/crates.io-index" 24 + checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" 25 + dependencies = [ 26 + "proc-macro2", 27 + "quote", 28 + "syn", 29 + ] 30 + 31 + [[package]] 32 + name = "autocfg" 33 + version = "1.4.0" 34 + source = "registry+https://github.com/rust-lang/crates.io-index" 35 + checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" 36 + 37 + [[package]] 38 + name = "axum" 39 + version = "0.7.9" 40 + source = "registry+https://github.com/rust-lang/crates.io-index" 41 + checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" 42 + dependencies = [ 43 + "async-trait", 44 + "axum-core", 45 + "bytes", 46 + "futures-util", 47 + "http", 48 + "http-body", 49 + "http-body-util", 50 + "hyper", 51 + "hyper-util", 52 + "itoa", 53 + "matchit", 54 + "memchr", 55 + "mime", 56 + "percent-encoding", 57 + "pin-project-lite", 58 + "rustversion", 59 + "serde", 60 + "serde_json", 61 + "serde_path_to_error", 62 + "serde_urlencoded", 63 + "sync_wrapper", 64 + "tokio", 65 + "tower", 66 + "tower-layer", 67 + "tower-service", 68 + "tracing", 69 + ] 70 + 71 + [[package]] 72 + name = "axum-core" 73 + version = "0.4.5" 74 + source = "registry+https://github.com/rust-lang/crates.io-index" 75 + checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199" 76 + dependencies = [ 77 + "async-trait", 78 + "bytes", 79 + "futures-util", 80 + "http", 81 + "http-body", 82 + "http-body-util", 83 + "mime", 84 + "pin-project-lite", 85 + "rustversion", 86 + "sync_wrapper", 87 + "tower-layer", 88 + "tower-service", 89 + "tracing", 90 + ] 91 + 92 + [[package]] 93 + name = "backtrace" 94 + version = "0.3.74" 95 + source = "registry+https://github.com/rust-lang/crates.io-index" 96 + checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" 97 + dependencies = [ 98 + "addr2line", 99 + "cfg-if", 100 + "libc", 101 + "miniz_oxide", 102 + "object", 103 + "rustc-demangle", 104 + "windows-targets", 105 + ] 106 + 107 + [[package]] 108 + name = "bitflags" 109 + version = "2.6.0" 110 + source = "registry+https://github.com/rust-lang/crates.io-index" 111 + checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" 112 + 113 + [[package]] 114 + name = "bytes" 115 + version = "1.9.0" 116 + source = "registry+https://github.com/rust-lang/crates.io-index" 117 + checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" 118 + 119 + [[package]] 120 + name = "cfg-if" 121 + version = "1.0.0" 122 + source = "registry+https://github.com/rust-lang/crates.io-index" 123 + checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 124 + 125 + [[package]] 126 + name = "fnv" 127 + version = "1.0.7" 128 + source = "registry+https://github.com/rust-lang/crates.io-index" 129 + checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 130 + 131 + [[package]] 132 + name = "form_urlencoded" 133 + version = "1.2.1" 134 + source = "registry+https://github.com/rust-lang/crates.io-index" 135 + checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" 136 + dependencies = [ 137 + "percent-encoding", 138 + ] 139 + 140 + [[package]] 141 + name = "futures-channel" 142 + version = "0.3.31" 143 + source = "registry+https://github.com/rust-lang/crates.io-index" 144 + checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" 145 + dependencies = [ 146 + "futures-core", 147 + ] 148 + 149 + [[package]] 150 + name = "futures-core" 151 + version = "0.3.31" 152 + source = "registry+https://github.com/rust-lang/crates.io-index" 153 + checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" 154 + 155 + [[package]] 156 + name = "futures-task" 157 + version = "0.3.31" 158 + source = "registry+https://github.com/rust-lang/crates.io-index" 159 + checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" 160 + 161 + [[package]] 162 + name = "futures-util" 163 + version = "0.3.31" 164 + source = "registry+https://github.com/rust-lang/crates.io-index" 165 + checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" 166 + dependencies = [ 167 + "futures-core", 168 + "futures-task", 169 + "pin-project-lite", 170 + "pin-utils", 171 + ] 172 + 173 + [[package]] 174 + name = "gimli" 175 + version = "0.31.1" 176 + source = "registry+https://github.com/rust-lang/crates.io-index" 177 + checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" 178 + 179 + [[package]] 180 + name = "http" 181 + version = "1.2.0" 182 + source = "registry+https://github.com/rust-lang/crates.io-index" 183 + checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" 184 + dependencies = [ 185 + "bytes", 186 + "fnv", 187 + "itoa", 188 + ] 189 + 190 + [[package]] 191 + name = "http-body" 192 + version = "1.0.1" 193 + source = "registry+https://github.com/rust-lang/crates.io-index" 194 + checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" 195 + dependencies = [ 196 + "bytes", 197 + "http", 198 + ] 199 + 200 + [[package]] 201 + name = "http-body-util" 202 + version = "0.1.2" 203 + source = "registry+https://github.com/rust-lang/crates.io-index" 204 + checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" 205 + dependencies = [ 206 + "bytes", 207 + "futures-util", 208 + "http", 209 + "http-body", 210 + "pin-project-lite", 211 + ] 212 + 213 + [[package]] 214 + name = "httparse" 215 + version = "1.9.5" 216 + source = "registry+https://github.com/rust-lang/crates.io-index" 217 + checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" 218 + 219 + [[package]] 220 + name = "httpdate" 221 + version = "1.0.3" 222 + source = "registry+https://github.com/rust-lang/crates.io-index" 223 + checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" 224 + 225 + [[package]] 226 + name = "hyper" 227 + version = "1.5.1" 228 + source = "registry+https://github.com/rust-lang/crates.io-index" 229 + checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f" 230 + dependencies = [ 231 + "bytes", 232 + "futures-channel", 233 + "futures-util", 234 + "http", 235 + "http-body", 236 + "httparse", 237 + "httpdate", 238 + "itoa", 239 + "pin-project-lite", 240 + "smallvec", 241 + "tokio", 242 + ] 243 + 244 + [[package]] 245 + name = "hyper-util" 246 + version = "0.1.10" 247 + source = "registry+https://github.com/rust-lang/crates.io-index" 248 + checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" 249 + dependencies = [ 250 + "bytes", 251 + "futures-util", 252 + "http", 253 + "http-body", 254 + "hyper", 255 + "pin-project-lite", 256 + "tokio", 257 + "tower-service", 258 + ] 259 + 260 + [[package]] 261 + name = "itoa" 262 + version = "1.0.14" 263 + source = "registry+https://github.com/rust-lang/crates.io-index" 264 + checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" 265 + 266 + [[package]] 267 + name = "libc" 268 + version = "0.2.168" 269 + source = "registry+https://github.com/rust-lang/crates.io-index" 270 + checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" 271 + 272 + [[package]] 273 + name = "lock_api" 274 + version = "0.4.12" 275 + source = "registry+https://github.com/rust-lang/crates.io-index" 276 + checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" 277 + dependencies = [ 278 + "autocfg", 279 + "scopeguard", 280 + ] 281 + 282 + [[package]] 283 + name = "log" 284 + version = "0.4.22" 285 + source = "registry+https://github.com/rust-lang/crates.io-index" 286 + checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" 287 + 288 + [[package]] 289 + name = "matchit" 290 + version = "0.7.3" 291 + source = "registry+https://github.com/rust-lang/crates.io-index" 292 + checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" 293 + 294 + [[package]] 295 + name = "memchr" 296 + version = "2.7.4" 297 + source = "registry+https://github.com/rust-lang/crates.io-index" 298 + checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" 299 + 300 + [[package]] 301 + name = "mime" 302 + version = "0.3.17" 303 + source = "registry+https://github.com/rust-lang/crates.io-index" 304 + checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" 305 + 306 + [[package]] 307 + name = "miniz_oxide" 308 + version = "0.8.0" 309 + source = "registry+https://github.com/rust-lang/crates.io-index" 310 + checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" 311 + dependencies = [ 312 + "adler2", 313 + ] 314 + 315 + [[package]] 316 + name = "mio" 317 + version = "1.0.3" 318 + source = "registry+https://github.com/rust-lang/crates.io-index" 319 + checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" 320 + dependencies = [ 321 + "libc", 322 + "wasi", 323 + "windows-sys", 324 + ] 325 + 326 + [[package]] 327 + name = "my-cli" 328 + version = "0.1.0" 329 + dependencies = [ 330 + "my-common", 331 + "my-workspace-hack", 332 + "tokio", 333 + ] 334 + 335 + [[package]] 336 + name = "my-common" 337 + version = "0.1.0" 338 + dependencies = [ 339 + "my-workspace-hack", 340 + "tokio", 341 + ] 342 + 343 + [[package]] 344 + name = "my-server" 345 + version = "0.1.0" 346 + dependencies = [ 347 + "axum", 348 + "my-common", 349 + "my-workspace-hack", 350 + "tokio", 351 + ] 352 + 353 + [[package]] 354 + name = "my-workspace-hack" 355 + version = "0.1.0" 356 + dependencies = [ 357 + "proc-macro2", 358 + "quote", 359 + "smallvec", 360 + "syn", 361 + "tokio", 362 + ] 363 + 364 + [[package]] 365 + name = "object" 366 + version = "0.36.5" 367 + source = "registry+https://github.com/rust-lang/crates.io-index" 368 + checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" 369 + dependencies = [ 370 + "memchr", 371 + ] 372 + 373 + [[package]] 374 + name = "once_cell" 375 + version = "1.20.2" 376 + source = "registry+https://github.com/rust-lang/crates.io-index" 377 + checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" 378 + 379 + [[package]] 380 + name = "parking_lot" 381 + version = "0.12.3" 382 + source = "registry+https://github.com/rust-lang/crates.io-index" 383 + checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" 384 + dependencies = [ 385 + "lock_api", 386 + "parking_lot_core", 387 + ] 388 + 389 + [[package]] 390 + name = "parking_lot_core" 391 + version = "0.9.10" 392 + source = "registry+https://github.com/rust-lang/crates.io-index" 393 + checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" 394 + dependencies = [ 395 + "cfg-if", 396 + "libc", 397 + "redox_syscall", 398 + "smallvec", 399 + "windows-targets", 400 + ] 401 + 402 + [[package]] 403 + name = "percent-encoding" 404 + version = "2.3.1" 405 + source = "registry+https://github.com/rust-lang/crates.io-index" 406 + checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" 407 + 408 + [[package]] 409 + name = "pin-project-lite" 410 + version = "0.2.15" 411 + source = "registry+https://github.com/rust-lang/crates.io-index" 412 + checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" 413 + 414 + [[package]] 415 + name = "pin-utils" 416 + version = "0.1.0" 417 + source = "registry+https://github.com/rust-lang/crates.io-index" 418 + checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 419 + 420 + [[package]] 421 + name = "proc-macro2" 422 + version = "1.0.92" 423 + source = "registry+https://github.com/rust-lang/crates.io-index" 424 + checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" 425 + dependencies = [ 426 + "unicode-ident", 427 + ] 428 + 429 + [[package]] 430 + name = "quote" 431 + version = "1.0.37" 432 + source = "registry+https://github.com/rust-lang/crates.io-index" 433 + checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" 434 + dependencies = [ 435 + "proc-macro2", 436 + ] 437 + 438 + [[package]] 439 + name = "redox_syscall" 440 + version = "0.5.8" 441 + source = "registry+https://github.com/rust-lang/crates.io-index" 442 + checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" 443 + dependencies = [ 444 + "bitflags", 445 + ] 446 + 447 + [[package]] 448 + name = "rustc-demangle" 449 + version = "0.1.24" 450 + source = "registry+https://github.com/rust-lang/crates.io-index" 451 + checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" 452 + 453 + [[package]] 454 + name = "rustversion" 455 + version = "1.0.18" 456 + source = "registry+https://github.com/rust-lang/crates.io-index" 457 + checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" 458 + 459 + [[package]] 460 + name = "ryu" 461 + version = "1.0.18" 462 + source = "registry+https://github.com/rust-lang/crates.io-index" 463 + checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" 464 + 465 + [[package]] 466 + name = "scopeguard" 467 + version = "1.2.0" 468 + source = "registry+https://github.com/rust-lang/crates.io-index" 469 + checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 470 + 471 + [[package]] 472 + name = "serde" 473 + version = "1.0.216" 474 + source = "registry+https://github.com/rust-lang/crates.io-index" 475 + checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" 476 + dependencies = [ 477 + "serde_derive", 478 + ] 479 + 480 + [[package]] 481 + name = "serde_derive" 482 + version = "1.0.216" 483 + source = "registry+https://github.com/rust-lang/crates.io-index" 484 + checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" 485 + dependencies = [ 486 + "proc-macro2", 487 + "quote", 488 + "syn", 489 + ] 490 + 491 + [[package]] 492 + name = "serde_json" 493 + version = "1.0.133" 494 + source = "registry+https://github.com/rust-lang/crates.io-index" 495 + checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" 496 + dependencies = [ 497 + "itoa", 498 + "memchr", 499 + "ryu", 500 + "serde", 501 + ] 502 + 503 + [[package]] 504 + name = "serde_path_to_error" 505 + version = "0.1.16" 506 + source = "registry+https://github.com/rust-lang/crates.io-index" 507 + checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6" 508 + dependencies = [ 509 + "itoa", 510 + "serde", 511 + ] 512 + 513 + [[package]] 514 + name = "serde_urlencoded" 515 + version = "0.7.1" 516 + source = "registry+https://github.com/rust-lang/crates.io-index" 517 + checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" 518 + dependencies = [ 519 + "form_urlencoded", 520 + "itoa", 521 + "ryu", 522 + "serde", 523 + ] 524 + 525 + [[package]] 526 + name = "signal-hook-registry" 527 + version = "1.4.2" 528 + source = "registry+https://github.com/rust-lang/crates.io-index" 529 + checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" 530 + dependencies = [ 531 + "libc", 532 + ] 533 + 534 + [[package]] 535 + name = "smallvec" 536 + version = "1.13.2" 537 + source = "registry+https://github.com/rust-lang/crates.io-index" 538 + checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" 539 + 540 + [[package]] 541 + name = "socket2" 542 + version = "0.5.8" 543 + source = "registry+https://github.com/rust-lang/crates.io-index" 544 + checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" 545 + dependencies = [ 546 + "libc", 547 + "windows-sys", 548 + ] 549 + 550 + [[package]] 551 + name = "syn" 552 + version = "2.0.90" 553 + source = "registry+https://github.com/rust-lang/crates.io-index" 554 + checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" 555 + dependencies = [ 556 + "proc-macro2", 557 + "quote", 558 + "unicode-ident", 559 + ] 560 + 561 + [[package]] 562 + name = "sync_wrapper" 563 + version = "1.0.2" 564 + source = "registry+https://github.com/rust-lang/crates.io-index" 565 + checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" 566 + 567 + [[package]] 568 + name = "tokio" 569 + version = "1.43.1" 570 + source = "registry+https://github.com/rust-lang/crates.io-index" 571 + checksum = "492a604e2fd7f814268a378409e6c92b5525d747d10db9a229723f55a417958c" 572 + dependencies = [ 573 + "backtrace", 574 + "bytes", 575 + "libc", 576 + "mio", 577 + "parking_lot", 578 + "pin-project-lite", 579 + "signal-hook-registry", 580 + "socket2", 581 + "tokio-macros", 582 + "windows-sys", 583 + ] 584 + 585 + [[package]] 586 + name = "tokio-macros" 587 + version = "2.5.0" 588 + source = "registry+https://github.com/rust-lang/crates.io-index" 589 + checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" 590 + dependencies = [ 591 + "proc-macro2", 592 + "quote", 593 + "syn", 594 + ] 595 + 596 + [[package]] 597 + name = "tower" 598 + version = "0.5.2" 599 + source = "registry+https://github.com/rust-lang/crates.io-index" 600 + checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" 601 + dependencies = [ 602 + "futures-core", 603 + "futures-util", 604 + "pin-project-lite", 605 + "sync_wrapper", 606 + "tokio", 607 + "tower-layer", 608 + "tower-service", 609 + "tracing", 610 + ] 611 + 612 + [[package]] 613 + name = "tower-layer" 614 + version = "0.3.3" 615 + source = "registry+https://github.com/rust-lang/crates.io-index" 616 + checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" 617 + 618 + [[package]] 619 + name = "tower-service" 620 + version = "0.3.3" 621 + source = "registry+https://github.com/rust-lang/crates.io-index" 622 + checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" 623 + 624 + [[package]] 625 + name = "tracing" 626 + version = "0.1.41" 627 + source = "registry+https://github.com/rust-lang/crates.io-index" 628 + checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" 629 + dependencies = [ 630 + "log", 631 + "pin-project-lite", 632 + "tracing-core", 633 + ] 634 + 635 + [[package]] 636 + name = "tracing-core" 637 + version = "0.1.33" 638 + source = "registry+https://github.com/rust-lang/crates.io-index" 639 + checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" 640 + dependencies = [ 641 + "once_cell", 642 + ] 643 + 644 + [[package]] 645 + name = "unicode-ident" 646 + version = "1.0.14" 647 + source = "registry+https://github.com/rust-lang/crates.io-index" 648 + checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" 649 + 650 + [[package]] 651 + name = "wasi" 652 + version = "0.11.0+wasi-snapshot-preview1" 653 + source = "registry+https://github.com/rust-lang/crates.io-index" 654 + checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 655 + 656 + [[package]] 657 + name = "windows-sys" 658 + version = "0.52.0" 659 + source = "registry+https://github.com/rust-lang/crates.io-index" 660 + checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 661 + dependencies = [ 662 + "windows-targets", 663 + ] 664 + 665 + [[package]] 666 + name = "windows-targets" 667 + version = "0.52.6" 668 + source = "registry+https://github.com/rust-lang/crates.io-index" 669 + checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" 670 + dependencies = [ 671 + "windows_aarch64_gnullvm", 672 + "windows_aarch64_msvc", 673 + "windows_i686_gnu", 674 + "windows_i686_gnullvm", 675 + "windows_i686_msvc", 676 + "windows_x86_64_gnu", 677 + "windows_x86_64_gnullvm", 678 + "windows_x86_64_msvc", 679 + ] 680 + 681 + [[package]] 682 + name = "windows_aarch64_gnullvm" 683 + version = "0.52.6" 684 + source = "registry+https://github.com/rust-lang/crates.io-index" 685 + checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" 686 + 687 + [[package]] 688 + name = "windows_aarch64_msvc" 689 + version = "0.52.6" 690 + source = "registry+https://github.com/rust-lang/crates.io-index" 691 + checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" 692 + 693 + [[package]] 694 + name = "windows_i686_gnu" 695 + version = "0.52.6" 696 + source = "registry+https://github.com/rust-lang/crates.io-index" 697 + checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" 698 + 699 + [[package]] 700 + name = "windows_i686_gnullvm" 701 + version = "0.52.6" 702 + source = "registry+https://github.com/rust-lang/crates.io-index" 703 + checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" 704 + 705 + [[package]] 706 + name = "windows_i686_msvc" 707 + version = "0.52.6" 708 + source = "registry+https://github.com/rust-lang/crates.io-index" 709 + checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" 710 + 711 + [[package]] 712 + name = "windows_x86_64_gnu" 713 + version = "0.52.6" 714 + source = "registry+https://github.com/rust-lang/crates.io-index" 715 + checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" 716 + 717 + [[package]] 718 + name = "windows_x86_64_gnullvm" 719 + version = "0.52.6" 720 + source = "registry+https://github.com/rust-lang/crates.io-index" 721 + checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" 722 + 723 + [[package]] 724 + name = "windows_x86_64_msvc" 725 + version = "0.52.6" 726 + source = "registry+https://github.com/rust-lang/crates.io-index" 727 + checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
+14
Cargo.toml
··· 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"
+10
crates/atpblog-cli/Cargo.toml
··· 1 + [package] 2 + name = "atpblog-cli" 3 + version.workspace = true 4 + edition.workspace = true 5 + publish = false 6 + 7 + [dependencies] 8 + atpblog-common = { path = "../atpblog-common" } 9 + atpblog-workspace-hack = { version = "0.1", path = "../atpblog-workspace-hack" } 10 + tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
+21
crates/atpblog-cli/src/main.rs
··· 1 + //! A cli which will echo every input argument to stdout 2 + 3 + #[tokio::main] 4 + async fn main() { 5 + let (tx, mut rx, fut) = my_common::echo_task(10, "echo".into()); 6 + let args = std::env::args().skip(1).collect::<Vec<_>>(); 7 + 8 + tokio::spawn(fut); 9 + tokio::spawn(async move { 10 + for arg in args { 11 + if tx.send(arg.into()).await.is_err() { 12 + eprintln!("channel was unexpectedly closed"); 13 + break; 14 + } 15 + } 16 + }); 17 + 18 + while let Some(msg) = rx.recv().await { 19 + println!("{msg}"); 20 + } 21 + }
+12
crates/atpblog-common/Cargo.toml
··· 1 + [package] 2 + name = "atpblog-common" 3 + version.workspace = true 4 + edition.workspace = true 5 + publish = false 6 + 7 + [dependencies] 8 + atpblog-workspace-hack = { version = "0.1", path = "../atpblog-workspace-hack" } 9 + tokio = { version = "1", features = ["sync"] } 10 + 11 + [dev-dependencies] 12 + tokio = { version = "1", features = ["macros", "rt"] }
+42
crates/atpblog-common/src/lib.rs
··· 1 + use std::{borrow::Cow, future::Future}; 2 + use tokio::sync::mpsc; 3 + 4 + /// Echoes messages back with the given prefix 5 + pub fn echo_task( 6 + buffer: usize, 7 + prefix: Cow<'static, str>, 8 + ) -> ( 9 + mpsc::Sender<Cow<'static, str>>, 10 + mpsc::Receiver<String>, 11 + impl Future<Output = ()>, 12 + ) { 13 + let (in_tx, mut in_rx) = mpsc::channel(buffer); 14 + let (out_tx, out_rx) = mpsc::channel(buffer); 15 + 16 + (in_tx, out_rx, async move { 17 + while let Some(msg) = in_rx.recv().await { 18 + let msg = format!("{prefix} {msg}"); 19 + if out_tx.send(msg).await.is_err() { 20 + break; 21 + } 22 + } 23 + }) 24 + } 25 + 26 + #[cfg(test)] 27 + mod test { 28 + use super::echo_task; 29 + 30 + #[tokio::test] 31 + async fn smoke() { 32 + let (tx, mut rx, fut) = echo_task(10, "hello".into()); 33 + 34 + tokio::spawn(fut); 35 + 36 + tx.send("world".into()).await.unwrap(); 37 + assert_eq!("hello world", rx.recv().await.unwrap()); 38 + 39 + tx.send("someone".into()).await.unwrap(); 40 + assert_eq!("hello someone", rx.recv().await.unwrap()); 41 + } 42 + }
+6
crates/atpblog-renderer/Cargo.toml
··· 1 + [package] 2 + name = "atpblog-renderer" 3 + version.workspace = true 4 + edition.workspace = true 5 + 6 + [dependencies]
+3
crates/atpblog-renderer/src/main.rs
··· 1 + fn main() { 2 + println!("Hello, world!"); 3 + }
+11
crates/atpblog-server/Cargo.toml
··· 1 + [package] 2 + name = "atpblog-server" 3 + version.workspace = true 4 + edition.workspace = true 5 + publish = false 6 + 7 + [dependencies] 8 + atpblog-common = { path = "../atpblog-common" } 9 + atpblog-workspace-hack = { version = "0.1", path = "../atpblog-workspace-hack" } 10 + axum = "0.7.5" 11 + tokio = { version = "1.43", features = ["full"] }
+42
crates/atpblog-server/src/main.rs
··· 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
··· 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
··· 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
··· 1 + // A build script is required for cargo to consider build dependencies. 2 + fn main() {}
+1
crates/atpblog-workspace-hack/src/lib.rs
··· 1 + // This is a stub lib.rs.
+6
deny.toml
··· 1 + [bans] 2 + multiple-versions = 'allow' 3 + 4 + [licenses] 5 + private = { ignore = true } 6 + allow = ["Apache-2.0", "BSD-3-Clause", "MIT", "Unicode-3.0"]
+199
flake.nix
··· 1 + { 2 + description = "Build a cargo workspace"; 3 + 4 + inputs = { 5 + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; 6 + 7 + crane.url = "github:ipetkov/crane"; 8 + 9 + fenix = { 10 + url = "github:nix-community/fenix"; 11 + inputs.nixpkgs.follows = "nixpkgs"; 12 + inputs.rust-analyzer-src.follows = ""; 13 + }; 14 + 15 + flake-utils.url = "github:numtide/flake-utils"; 16 + 17 + advisory-db = { 18 + url = "github:rustsec/advisory-db"; 19 + flake = false; 20 + }; 21 + }; 22 + 23 + outputs = { self, nixpkgs, crane, fenix, flake-utils, advisory-db, ... }: 24 + flake-utils.lib.eachDefaultSystem (system: 25 + let 26 + pkgs = nixpkgs.legacyPackages.${system}; 27 + 28 + inherit (pkgs) lib; 29 + 30 + craneLib = crane.mkLib pkgs; 31 + src = craneLib.cleanCargoSource ./.; 32 + 33 + # Common arguments can be set here to avoid repeating them later 34 + commonArgs = { 35 + inherit src; 36 + strictDeps = true; 37 + 38 + buildInputs = [ 39 + # Add additional build inputs here 40 + ] ++ lib.optionals pkgs.stdenv.isDarwin [ 41 + # Additional darwin specific inputs can be set here 42 + pkgs.libiconv 43 + ]; 44 + 45 + # Additional environment variables can be set directly 46 + # MY_CUSTOM_VAR = "some value"; 47 + }; 48 + 49 + craneLibLLvmTools = craneLib.overrideToolchain 50 + (fenix.packages.${system}.complete.withComponents [ 51 + "cargo" 52 + "llvm-tools" 53 + "rustc" 54 + ]); 55 + 56 + # Build *just* the cargo dependencies (of the entire workspace), 57 + # so we can reuse all of that work (e.g. via cachix) when running in CI 58 + # It is *highly* recommended to use something like cargo-hakari to avoid 59 + # cache misses when building individual top-level-crates 60 + cargoArtifacts = craneLib.buildDepsOnly commonArgs; 61 + 62 + individualCrateArgs = commonArgs // { 63 + inherit cargoArtifacts; 64 + inherit (craneLib.crateNameFromCargoToml { inherit src; }) version; 65 + # NB: we disable tests since we'll run them all via cargo-nextest 66 + doCheck = false; 67 + }; 68 + 69 + fileSetForCrate = crate: lib.fileset.toSource { 70 + root = ./.; 71 + fileset = lib.fileset.unions [ 72 + ./Cargo.toml 73 + ./Cargo.lock 74 + (craneLib.fileset.commonCargoSources ./crates/my-common) 75 + (craneLib.fileset.commonCargoSources ./crates/my-workspace-hack) 76 + (craneLib.fileset.commonCargoSources crate) 77 + ]; 78 + }; 79 + 80 + # Build the top-level crates of the workspace as individual derivations. 81 + # This allows consumers to only depend on (and build) only what they need. 82 + # Though it is possible to build the entire workspace as a single derivation, 83 + # so this is left up to you on how to organize things 84 + # 85 + # Note that the cargo workspace must define `workspace.members` using wildcards, 86 + # otherwise, omitting a crate (like we do below) will result in errors since 87 + # cargo won't be able to find the sources for all members. 88 + atpblog-cli = craneLib.buildPackage (individualCrateArgs // { 89 + pname = "my-cli"; 90 + cargoExtraArgs = "-p my-cli"; 91 + src = fileSetForCrate ./crates/my-cli; 92 + }); 93 + atpblog-server = craneLib.buildPackage (individualCrateArgs // { 94 + pname = "my-server"; 95 + cargoExtraArgs = "-p my-server"; 96 + src = fileSetForCrate ./crates/my-server; 97 + }); 98 + in 99 + { 100 + checks = { 101 + # Build the crates as part of `nix flake check` for convenience 102 + inherit atpblog-cli atpblog-server; 103 + 104 + # Run clippy (and deny all warnings) on the workspace source, 105 + # again, reusing the dependency artifacts from above. 106 + # 107 + # Note that this is done as a separate derivation so that 108 + # we can block the CI if there are issues here, but not 109 + # prevent downstream consumers from building our crate by itself. 110 + atpblog-workspace-clippy = craneLib.cargoClippy (commonArgs // { 111 + inherit cargoArtifacts; 112 + cargoClippyExtraArgs = "--all-targets -- --deny warnings"; 113 + }); 114 + 115 + atpblog-workspace-doc = craneLib.cargoDoc (commonArgs // { 116 + inherit cargoArtifacts; 117 + }); 118 + 119 + # Check formatting 120 + atpblog-workspace-fmt = craneLib.cargoFmt { 121 + inherit src; 122 + }; 123 + 124 + atpblog-workspace-toml-fmt = craneLib.taploFmt { 125 + src = pkgs.lib.sources.sourceFilesBySuffices src [ ".toml" ]; 126 + # taplo arguments can be further customized below as needed 127 + # taploExtraArgs = "--config ./taplo.toml"; 128 + }; 129 + 130 + # Audit dependencies 131 + atpblog-workspace-audit = craneLib.cargoAudit { 132 + inherit src advisory-db; 133 + }; 134 + 135 + # Audit licenses 136 + atpblog-workspace-deny = craneLib.cargoDeny { 137 + inherit src; 138 + }; 139 + 140 + # Run tests with cargo-nextest 141 + # Consider setting `doCheck = false` on other crate derivations 142 + # if you do not want the tests to run twice 143 + atpblog-workspace-nextest = craneLib.cargoNextest (commonArgs // { 144 + inherit cargoArtifacts; 145 + partitions = 1; 146 + partitionType = "count"; 147 + cargoNextestPartitionsExtraArgs = "--no-tests=pass"; 148 + }); 149 + 150 + # Ensure that cargo-hakari is up to date 151 + atpblog-workspace-hakari = craneLib.mkCargoDerivation { 152 + inherit src; 153 + pname = "atpblog-workspace-hakari"; 154 + cargoArtifacts = null; 155 + doInstallCargoArtifacts = false; 156 + 157 + buildPhaseCargoCommand = '' 158 + cargo hakari generate --diff # workspace-hack Cargo.toml is up-to-date 159 + cargo hakari manage-deps --dry-run # all workspace crates depend on workspace-hack 160 + cargo hakari verify 161 + ''; 162 + 163 + nativeBuildInputs = [ 164 + pkgs.cargo-hakari 165 + ]; 166 + }; 167 + }; 168 + 169 + packages = { 170 + inherit atpblog-cli atpblog-server; 171 + } // lib.optionalAttrs (!pkgs.stdenv.isDarwin) { 172 + atpblog-workspace-llvm-coverage = craneLibLLvmTools.cargoLlvmCov (commonArgs // { 173 + inherit cargoArtifacts; 174 + }); 175 + }; 176 + 177 + apps = { 178 + atpblog-cli = flake-utils.lib.mkApp { 179 + drv = atpblog-cli; 180 + }; 181 + atpblog-server = flake-utils.lib.mkApp { 182 + drv = atpblog-server; 183 + }; 184 + }; 185 + 186 + devShells.default = craneLib.devShell { 187 + # Inherit inputs from checks. 188 + checks = self.checks.${system}; 189 + 190 + # Additional dev-shell environment variables can be set directly 191 + # MY_CUSTOM_DEVELOPMENT_VAR = "something else"; 192 + 193 + # Extra inputs can be added here; cargo and rustc are provided by default. 194 + packages = [ 195 + pkgs.cargo-hakari 196 + ]; 197 + }; 198 + }); 199 + }
+13
taplo.toml
··· 1 + # Sorts `Cargo.toml` dependencies. All other `.toml` files are formatted with the default config. 2 + # 3 + # https://taplo.tamasfe.dev/configuration/file.html#configuration-file 4 + 5 + [formatting] 6 + reorder_keys = false 7 + 8 + [[rule]] 9 + include = ["**/Cargo.toml"] 10 + keys = ["dependencies"] 11 + 12 + [rule.formatting] 13 + reorder_keys = true