Trait HtmxRouter

Source
pub trait HtmxRouter: Sized {
    type State: Send + Sync + Clone + 'static;

    // Required method
    fn htmx_route(self, handler: impl HtmxHandler<Self::State>) -> Self;
}
Expand description

A trait that allows typed routes, created with the hx_ macros to be added to an axum router.

Required Associated Types§

Source

type State: Send + Sync + Clone + 'static

The state type of the router.

Required Methods§

Source

fn htmx_route(self, handler: impl HtmxHandler<Self::State>) -> Self

Add an HTMX route to the router.

Typed handlers are functions that return HtmxHandler.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<S> HtmxRouter for Router<S>
where S: Send + Sync + Clone + 'static,

Source§

type State = S

Source§

fn htmx_route(self, handler: impl HtmxHandler<Self::State>) -> Self

Implementors§