diff --git a/src/extractors.rs b/src/extractors.rs index f7a3de6..81ab239 100644 --- a/src/extractors.rs +++ b/src/extractors.rs @@ -42,8 +42,8 @@ where /// This is set on every request made by htmx itself. As its name implies, it /// just contains the current url. /// -/// This extractor will always return a value. If the header is not present, or extractor fails to parse the url -/// it will return `None`. +/// This extractor will always return a value. If the header is not present, or +/// extractor fails to parse the url it will return `None`. #[derive(Debug, Clone)] pub struct HxCurrentUrl(pub Option); @@ -60,7 +60,7 @@ where .to_str() .ok() .and_then(|url| url.parse::().ok()); - + return Ok(HxCurrentUrl(url)); } @@ -70,8 +70,8 @@ where /// The `HX-History-Restore-Request` header. /// -/// This extractor will always return a value. If the header is not present, -/// it will return `false`. +/// This extractor will always return a value. If the header is not present, it +/// will return `false`. #[derive(Debug, Clone, Copy)] pub struct HxHistoryRestoreRequest(pub bool); @@ -148,8 +148,8 @@ where /// The `HX-Target` header. /// /// This is set when a request is made from an element that has the `hx-target` -/// attribute set. The value will contain the target element's id. If the -/// id does not exist on the page, the value will be None. +/// attribute set. The value will contain the target element's id. If the id +/// does not exist on the page, the value will be None. /// /// This extractor will always return a value. If the header is not present, it /// will return `None`. @@ -206,8 +206,8 @@ where /// The `HX-Trigger` header. /// /// This is set when a request is made from an element that has the `hx-trigger` -/// attribute set. The value will contain the trigger element's id. If the -/// id does not exist on the page, the value will be None. +/// attribute set. The value will contain the trigger element's id. If the id +/// does not exist on the page, the value will be None. /// /// This extractor will always return a value. If the header is not present, it /// will return `None`. diff --git a/src/responders/location.rs b/src/responders/location.rs index c7ff3ca..92c2a82 100644 --- a/src/responders/location.rs +++ b/src/responders/location.rs @@ -83,7 +83,7 @@ impl HxLocation { path: self.uri.to_string(), opts: self.options, }; - + Ok(serde_json::to_string(&loc_with_opts)?) } } @@ -147,7 +147,8 @@ impl IntoResponseParts for HxLocation { /// - `swap` - how the response will be swapped in relative to the target /// - `values` - values to submit with the request /// - `headers` - headers to submit with the request -/// - `select` - allows you to select the content you want swapped from a response +/// - `select` - allows you to select the content you want swapped from a +/// response #[cfg(feature = "serde")] #[cfg_attr(feature = "unstable", doc(cfg(feature = "serde")))] #[derive(Debug, Clone, serde::Serialize, Default)] diff --git a/src/responders/trigger.rs b/src/responders/trigger.rs index 393d1a0..7756b46 100644 --- a/src/responders/trigger.rs +++ b/src/responders/trigger.rs @@ -103,9 +103,9 @@ pub enum TriggerMode { /// The `HX-Trigger*` header. /// -/// Allows you to trigger client-side events. -/// Corresponds to `HX-Trigger`, `HX-Trigger-After-Settle` and `HX-Trigger-After-Swap` headers. -/// To change when events trigger use appropriate `mode`. +/// Allows you to trigger client-side events. Corresponds to `HX-Trigger`, +/// `HX-Trigger-After-Settle` and `HX-Trigger-After-Swap` headers. To change +/// when events trigger use appropriate `mode`. /// /// Will fail if the supplied events contain or produce characters that are not /// visible ASCII (32-127) when serializing to JSON. @@ -118,7 +118,8 @@ pub struct HxResponseTrigger { } impl HxResponseTrigger { - /// Creates new [trigger](https://htmx.org/headers/hx-trigger/) with specified mode and events. + /// Creates new [trigger](https://htmx.org/headers/hx-trigger/) with + /// specified mode and events. pub fn new>(mode: TriggerMode, events: impl IntoIterator) -> Self { Self { mode, @@ -126,17 +127,20 @@ impl HxResponseTrigger { } } - /// Creates new [normal](https://htmx.org/headers/hx-trigger/) trigger from events. + /// Creates new [normal](https://htmx.org/headers/hx-trigger/) trigger from + /// events. pub fn normal>(events: impl IntoIterator) -> Self { Self::new(TriggerMode::Normal, events) } - /// Creates new [after settle](https://htmx.org/headers/hx-trigger/) trigger from events. + /// Creates new [after settle](https://htmx.org/headers/hx-trigger/) trigger + /// from events. pub fn after_settle>(events: impl IntoIterator) -> Self { Self::new(TriggerMode::AfterSettle, events) } - /// Creates new [after swap](https://htmx.org/headers/hx-trigger/) trigger from events. + /// Creates new [after swap](https://htmx.org/headers/hx-trigger/) trigger + /// from events. pub fn after_swap>(events: impl IntoIterator) -> Self { Self::new(TriggerMode::AfterSwap, events) }