#static #axum #router #fold #serve #assert #tokio

macro axum_static_include

Proc-Macro for embedding static fold router

2 unstable releases

0.3.0 Aug 25, 2023
0.2.0 Aug 25, 2023

#11 in #fold

MIT license

8KB
122 lines

Axum Static Include

Embed files of fold in binary and create router.

Example

#[axum_static_include::static_serve("assert")]
fn assert_fold() -> axum::Router {}

#[tokio::main]
async fn main() {
    let asserts = assert_fold();
    let app = Router::new()
        .nest("/static", asserts)
    // ...
}

lib.rs:

用于 axum 包含静态文件的宏

这个宏主要用于将静态文件以 include_*!() 的形式来包含进二进制文件中

Dependencies

~0.8–1.4MB
~30K SLoC