macro_rules! vpath {
($e:expr) => { ... };
}
Expand description
This macro aborts compilation if the path is invalid.
This example will fail to compile:
ⓘ
use axum::routing::{Router, get};
use axum_extra::vpath;
let router = axum::Router::<()>::new()
.route(vpath!("invalid_path"), get(root))
.to_owned();
async fn root() {}
This one will compile without problems:
use axum::routing::{Router, get};
use axum_extra::vpath;
let router = axum::Router::<()>::new()
.route(vpath!("/valid_path"), get(root))
.to_owned();
async fn root() {}
This macro is available only on rust versions 1.80 and above.