macro_rules! define_params {
(
$name:ident for $path:literal {
$( $field:ident : $ty:ty ),* $(,)?
}
) => { ... };
}Expand description
Defines path parameters for a route and implements EndpointParams.
Each struct field maps to a :field segment in path (by field name).
For compile-time path validation, use #[derive(EndpointParamsDerive)] (feature macros).
§Examples
use better_fetch::{define_params, EndpointParams, NeedsParams};
define_params!(GetTodoParams for "/todos/:id" { id: u64 });
fn assert_needs_params<T: EndpointParams<BuilderState = NeedsParams>>() {}
assert_needs_params::<GetTodoParams>();