mirror of
https://github.com/robertwayne/axum-htmx
synced 2024-11-24 04:12:50 +01:00
Update comments; fix naming on serde::Hx* variants
This commit is contained in:
parent
2045b19c6f
commit
435cbf56db
2 changed files with 30 additions and 20 deletions
|
@ -22,7 +22,9 @@ const HX_SWAP_NONE: &str = "none";
|
||||||
/// The `HX-Location` header.
|
/// The `HX-Location` header.
|
||||||
///
|
///
|
||||||
/// This response header can be used to trigger a client side redirection
|
/// This response header can be used to trigger a client side redirection
|
||||||
/// without reloading the whole page.
|
/// without reloading the whole page. If you intend to redirect to a specific
|
||||||
|
/// target on the page, you must enable the `serde` feature flag and use
|
||||||
|
/// `axum_htmx::responders::serde::HxLocation` instead.
|
||||||
///
|
///
|
||||||
/// Will fail if the supplied Uri contains characters that are not visible ASCII
|
/// Will fail if the supplied Uri contains characters that are not visible ASCII
|
||||||
/// (32-127).
|
/// (32-127).
|
||||||
|
@ -205,9 +207,9 @@ impl IntoResponseParts for HxReselect {
|
||||||
|
|
||||||
/// The `HX-Trigger` header.
|
/// The `HX-Trigger` header.
|
||||||
///
|
///
|
||||||
/// Allows you to trigger client-side events. This only accepts events without
|
/// Allows you to trigger client-side events. If you intend to add data to your
|
||||||
/// data attached. If you intend to add data to the event, you must enable the
|
/// events, you must enable the `serde` feature flag and use
|
||||||
/// `serde` feature flag.
|
/// `axum_htmx::responders::serde::HxResponseTrigger` instead.
|
||||||
///
|
///
|
||||||
/// Will fail if the supplied events contain or produce characters that are not
|
/// Will fail if the supplied events contain or produce characters that are not
|
||||||
/// visible ASCII (32-127) when serializing to JSON.
|
/// visible ASCII (32-127) when serializing to JSON.
|
||||||
|
@ -236,9 +238,10 @@ impl IntoResponseParts for HxResponseTrigger {
|
||||||
|
|
||||||
/// The `HX-Trigger-After-Settle` header.
|
/// The `HX-Trigger-After-Settle` header.
|
||||||
///
|
///
|
||||||
/// Allows you to trigger client-side events after the settle step. This only
|
/// Allows you to trigger client-side events after the settle step. If you
|
||||||
/// accepts events without data attached. If you intend to add data to the
|
/// intend to add data to your events, you must enable the `serde` feature flag
|
||||||
/// event, you must enable the `serde` feature flag.
|
/// and use `axum_htmx::responders::serde::HxResponseTriggerAfterSettle`
|
||||||
|
/// instead.
|
||||||
///
|
///
|
||||||
/// Will fail if the supplied events contain or produce characters that are not
|
/// Will fail if the supplied events contain or produce characters that are not
|
||||||
/// visible ASCII (32-127) when serializing to JSON.
|
/// visible ASCII (32-127) when serializing to JSON.
|
||||||
|
@ -267,9 +270,9 @@ impl IntoResponseParts for HxResponseTriggerAfterSettle {
|
||||||
|
|
||||||
/// The `HX-Trigger-After-Swap` header.
|
/// The `HX-Trigger-After-Swap` header.
|
||||||
///
|
///
|
||||||
/// Allows you to trigger client-side events after the swap step. This only
|
/// Allows you to trigger client-side events after the swap step. If you intend
|
||||||
/// accepts events without data attached. If you intend to add data to the
|
/// to add data to your events, you must enable the `serde` feature flag and use
|
||||||
/// event, you must enable the `serde` feature flag.
|
/// `axum_htmx::responders::serde::HxResponseTriggerAfterSwap` instead.
|
||||||
///
|
///
|
||||||
/// Will fail if the supplied events contain or produce characters that are not
|
/// Will fail if the supplied events contain or produce characters that are not
|
||||||
/// visible ASCII (32-127) when serializing to JSON.
|
/// visible ASCII (32-127) when serializing to JSON.
|
||||||
|
|
|
@ -19,7 +19,9 @@ use crate::{
|
||||||
/// The `HX-Location` header.
|
/// The `HX-Location` header.
|
||||||
///
|
///
|
||||||
/// This response header can be used to trigger a client side redirection
|
/// This response header can be used to trigger a client side redirection
|
||||||
/// without reloading the whole page.
|
/// without reloading the whole page. If you only intend to redirect to the
|
||||||
|
/// `document.body`, as opposed to a specific target, you can use
|
||||||
|
/// `axum_htmx::responders::HxResponseLocation` instead.
|
||||||
///
|
///
|
||||||
/// Will fail if the supplied data contains or produces characters that are not
|
/// Will fail if the supplied data contains or produces characters that are not
|
||||||
/// visible ASCII (32-127) when serializing to JSON.
|
/// visible ASCII (32-127) when serializing to JSON.
|
||||||
|
@ -85,16 +87,17 @@ impl IntoResponseParts for HxLocation {
|
||||||
|
|
||||||
/// The `HX-Trigger` header.
|
/// The `HX-Trigger` header.
|
||||||
///
|
///
|
||||||
/// Allows you to trigger client-side events.
|
/// Allows you to trigger client-side events. If you only need to send bare
|
||||||
|
/// events, you can use `axum_htmx::responders::HxResponseTrigger` instead.
|
||||||
///
|
///
|
||||||
/// Will fail if the supplied events contain or produce characters that are not
|
/// Will fail if the supplied events contain or produce characters that are not
|
||||||
/// visible ASCII (32-127) when serializing to JSON.
|
/// visible ASCII (32-127) when serializing to JSON.
|
||||||
///
|
///
|
||||||
/// See <https://htmx.org/headers/hx-trigger/> for more information.
|
/// See <https://htmx.org/headers/hx-trigger/> for more information.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct HxTrigger(pub Vec<HxEvent>);
|
pub struct HxResponseTrigger(pub Vec<HxEvent>);
|
||||||
|
|
||||||
impl IntoResponseParts for HxTrigger {
|
impl IntoResponseParts for HxResponseTrigger {
|
||||||
type Error = HxError;
|
type Error = HxError;
|
||||||
|
|
||||||
fn into_response_parts(self, mut res: ResponseParts) -> Result<ResponseParts, Self::Error> {
|
fn into_response_parts(self, mut res: ResponseParts) -> Result<ResponseParts, Self::Error> {
|
||||||
|
@ -107,16 +110,18 @@ impl IntoResponseParts for HxTrigger {
|
||||||
|
|
||||||
/// The `HX-Trigger-After-Settle` header.
|
/// The `HX-Trigger-After-Settle` header.
|
||||||
///
|
///
|
||||||
/// Allows you to trigger client-side events after the settle step.
|
/// Allows you to trigger client-side events after the settle step. If you only
|
||||||
|
/// intend to send bare events, you can use
|
||||||
|
/// `axum_htmx::responders::HxResponseTriggerAfterSettle` instead.
|
||||||
///
|
///
|
||||||
/// Will fail if the supplied events contain or produce characters that are not
|
/// Will fail if the supplied events contain or produce characters that are not
|
||||||
/// visible ASCII (32-127) when serializing to JSON.
|
/// visible ASCII (32-127) when serializing to JSON.
|
||||||
///
|
///
|
||||||
/// See <https://htmx.org/headers/hx-trigger/> for more information.
|
/// See <https://htmx.org/headers/hx-trigger/> for more information.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct HxTriggerAfterSettle(Vec<HxEvent>);
|
pub struct HxResponseTriggerAfterSettle(pub Vec<HxEvent>);
|
||||||
|
|
||||||
impl IntoResponseParts for HxTriggerAfterSettle {
|
impl IntoResponseParts for HxResponseTriggerAfterSettle {
|
||||||
type Error = HxError;
|
type Error = HxError;
|
||||||
|
|
||||||
fn into_response_parts(self, mut res: ResponseParts) -> Result<ResponseParts, Self::Error> {
|
fn into_response_parts(self, mut res: ResponseParts) -> Result<ResponseParts, Self::Error> {
|
||||||
|
@ -131,16 +136,18 @@ impl IntoResponseParts for HxTriggerAfterSettle {
|
||||||
|
|
||||||
/// The `HX-Trigger-After-Swap` header.
|
/// The `HX-Trigger-After-Swap` header.
|
||||||
///
|
///
|
||||||
/// Allows you to trigger client-side events after the swap step.
|
/// Allows you to trigger client-side events after the swap step. If you only
|
||||||
|
/// need to send bare events, you can use
|
||||||
|
/// `axum_htmx::responders::HxResponseTriggerAfterSwao` instead.
|
||||||
///
|
///
|
||||||
/// Will fail if the supplied events contain or produce characters that are not
|
/// Will fail if the supplied events contain or produce characters that are not
|
||||||
/// visible ASCII (32-127) when serializing to JSON.
|
/// visible ASCII (32-127) when serializing to JSON.
|
||||||
///
|
///
|
||||||
/// See <https://htmx.org/headers/hx-trigger/> for more information.
|
/// See <https://htmx.org/headers/hx-trigger/> for more information.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct HxTriggerAfterSwap(Vec<HxEvent>);
|
pub struct HxResponseTriggerAfterSwap(pub Vec<HxEvent>);
|
||||||
|
|
||||||
impl IntoResponseParts for HxTriggerAfterSwap {
|
impl IntoResponseParts for HxResponseTriggerAfterSwap {
|
||||||
type Error = HxError;
|
type Error = HxError;
|
||||||
|
|
||||||
fn into_response_parts(self, mut res: ResponseParts) -> Result<ResponseParts, Self::Error> {
|
fn into_response_parts(self, mut res: ResponseParts) -> Result<ResponseParts, Self::Error> {
|
||||||
|
|
Loading…
Reference in a new issue