# tower-serve-embedded-build

Build-time helper for [`tower-serve-embedded`](https://crates.io/crates/tower-serve-embedded).

Call it from your crate's `build.rs`. It walks an asset directory, content-hashes every file with
BLAKE3, detects MIME types, and generates a Rust file (in `OUT_DIR`) containing the embedded
manifest (`ASSETS`) and a compile-time `asset!` macro. There are **no proc macros** — the generated
code is plain data plus a tiny `macro_rules!`, so IDE support stays sharp.

```toml
# Cargo.toml
[build-dependencies]
tower-serve-embedded-build = "0.1"
```

```rust
// build.rs
fn main() {
    tower_serve_embedded_build::Builder::new("assets") // dir relative to your crate root
        // .serve_at("/static")                         // publish URLs under /static and mount there
        // .immutable_dir("lib")                        // already-versioned deps: serve as-is
        // .hash_length(16)                             // hash chars in filenames/ETags
        .emit()
        .unwrap();
}
```

Then pull the generated code into your crate with
[`tower_serve_embedded::embed!()`](https://crates.io/crates/tower-serve-embedded), which brings the
`ASSETS` static and the crate-local `asset!` macro into scope. If you use `serve_at`, mount
`ASSETS.service()` at the same path; `asset!` emits public URLs under that path while the service
resolves the mount-relative requests it receives.

See the [`tower-serve-embedded`](https://crates.io/crates/tower-serve-embedded) crate for the full
story, the runtime `tower::Service`, and runnable `axum`/`actix`/`warp` examples.

## License

MIT OR Apache-2.0.
