cached
cached copied to clipboard
`cached` compile error "expected struct / found reference"
Hello,
could you, please, help me and tell me what am I doing wrong or what am I missing?
Cargo.toml:
cached = "0.34"
code:
#[cached(
name = "ASSETS",
time = 300,
key = "&str",
convert = r#"{ "" }"#,
result = true
)]
#[axum_macros::debug_handler]
async fn list_assets(
Extension(state): Extension<SharedState>,
) -> Result<Json<Vec<Asset>>, StatusCodeWithMessage> {
...
}
error:
error[E0308]: mismatched types
--> portfolio-be-web\src\rpc\endpoints.rs:32:1
|
32 | / #[cached(
33 | | name = "ASSETS",
34 | | time = 300,
35 | | key = "&str",
36 | | convert = r#"{ "" }"#,
37 | | result = true
38 | | )]
| |__^ expected struct `axum::Json`, found reference
|
= note: expected struct `axum::Json<Vec<Asset>>`
found reference `&axum::Json<Vec<Asset>>`
= note: this error originates in the attribute macro `cached` (in Nightly builds, run with -Z macro-backtrace for more info)
https://github.com/jaemk/cached/issues/124