Formatting

This commit is contained in:
Rob Wagner 2023-12-03 15:56:03 -05:00
parent 9d559d0041
commit 29dbadc8bc
No known key found for this signature in database
GPG key ID: 53CCB4497B15CF61
3 changed files with 23 additions and 18 deletions

View file

@ -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<http::Uri>);
@ -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`.

View file

@ -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)]

View file

@ -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<T: Into<HxEvent>>(mode: TriggerMode, events: impl IntoIterator<Item = T>) -> 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<T: Into<HxEvent>>(events: impl IntoIterator<Item = T>) -> 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<T: Into<HxEvent>>(events: impl IntoIterator<Item = T>) -> 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<T: Into<HxEvent>>(events: impl IntoIterator<Item = T>) -> Self {
Self::new(TriggerMode::AfterSwap, events)
}