From 145abcc92a8bcf7090b49e235bf25acd0a5e9c59 Mon Sep 17 00:00:00 2001 From: Rob Wagner Date: Mon, 23 Oct 2023 21:40:21 -0400 Subject: [PATCH] Shorten import path in comments --- src/responders.rs | 6 ++++++ src/responders/serde.rs | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/responders.rs b/src/responders.rs index 22709d3..1e1a712 100644 --- a/src/responders.rs +++ b/src/responders.rs @@ -218,6 +218,12 @@ impl IntoResponseParts for HxReselect { #[derive(Debug, Clone)] pub struct HxResponseTrigger(pub Vec); +impl HxResponseTrigger { + pub fn new(events: &[&str]) -> Self { + Self(events.iter().map(|e| e.to_string()).collect()) + } +} + impl IntoResponseParts for HxResponseTrigger { type Error = HxError; diff --git a/src/responders/serde.rs b/src/responders/serde.rs index 3bb7219..8121af4 100644 --- a/src/responders/serde.rs +++ b/src/responders/serde.rs @@ -21,7 +21,7 @@ use crate::{ /// This response header can be used to trigger a client side redirection /// 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. +/// `axum_htmx::HxResponseLocation` instead. /// /// Will fail if the supplied data contains or produces characters that are not /// visible ASCII (32-127) when serializing to JSON. @@ -88,7 +88,7 @@ impl IntoResponseParts for HxLocation { /// The `HX-Trigger` header. /// /// Allows you to trigger client-side events. If you only need to send bare -/// events, you can use `axum_htmx::responders::HxResponseTrigger` instead. +/// events, you can use `axum_htmx::HxResponseTrigger` instead. /// /// Will fail if the supplied events contain or produce characters that are not /// visible ASCII (32-127) when serializing to JSON. @@ -112,7 +112,7 @@ impl IntoResponseParts for HxResponseTrigger { /// /// 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. +/// `axum_htmx::HxResponseTriggerAfterSettle` instead. /// /// Will fail if the supplied events contain or produce characters that are not /// visible ASCII (32-127) when serializing to JSON. @@ -138,7 +138,7 @@ impl IntoResponseParts for HxResponseTriggerAfterSettle { /// /// 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. +/// `axum_htmx::HxResponseTriggerAfterSwao` instead. /// /// Will fail if the supplied events contain or produce characters that are not /// visible ASCII (32-127) when serializing to JSON.