Skip to main content

guards

Macro guards 

Source
macro_rules! guards {
    [$($guard:expr),* $(,)?] => { ... };
}
Expand description

Collects Guard registrations for per-route Guard configuration.

Returns a Vec<RegisteredGuard> for use with post_with_guards(), get_with_guards(), and other per-route Guard methods.

§Example

use ranvier_http::guards;
use ranvier_guard::prelude::*;

Ranvier::http()
    .guard(AccessLogGuard::new())  // global guard
    .post_with_guards("/api/orders", order_circuit, guards![
        ContentTypeGuard::json(),
        IdempotencyGuard::ttl_5min(),
    ])
    .get("/api/orders", list_circuit)  // no extra guards