Shorten import path in comments

This commit is contained in:
Rob Wagner 2023-10-23 21:40:21 -04:00
parent 435cbf56db
commit 145abcc92a
No known key found for this signature in database
GPG key ID: 53CCB4497B15CF61
2 changed files with 10 additions and 4 deletions

View file

@ -218,6 +218,12 @@ impl IntoResponseParts for HxReselect {
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct HxResponseTrigger(pub Vec<String>); pub struct HxResponseTrigger(pub Vec<String>);
impl HxResponseTrigger {
pub fn new(events: &[&str]) -> Self {
Self(events.iter().map(|e| e.to_string()).collect())
}
}
impl IntoResponseParts for HxResponseTrigger { impl IntoResponseParts for HxResponseTrigger {
type Error = HxError; type Error = HxError;

View file

@ -21,7 +21,7 @@ use crate::{
/// 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. If you only intend to redirect to the /// without reloading the whole page. If you only intend to redirect to the
/// `document.body`, as opposed to a specific target, you can use /// `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 /// 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.
@ -88,7 +88,7 @@ impl IntoResponseParts for HxLocation {
/// The `HX-Trigger` header. /// The `HX-Trigger` header.
/// ///
/// Allows you to trigger client-side events. If you only need to send bare /// 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 /// 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.
@ -112,7 +112,7 @@ impl IntoResponseParts for HxResponseTrigger {
/// ///
/// Allows you to trigger client-side events after the settle step. If you only /// Allows you to trigger client-side events after the settle step. If you only
/// intend to send bare events, you can use /// 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 /// 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.
@ -138,7 +138,7 @@ impl IntoResponseParts for HxResponseTriggerAfterSettle {
/// ///
/// Allows you to trigger client-side events after the swap step. If you only /// Allows you to trigger client-side events after the swap step. If you only
/// need to send bare events, you can use /// 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 /// 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.