#[non_exhaustive]pub struct HtmxRequest {
pub is_htmx: bool,
pub trigger: Option<String>,
pub target: Option<String>,
pub prompt: Option<String>,
pub current_url: Option<String>,
/* private fields */
}Expand description
Extract’s HTMX request headers to determine context and re-act re-actively.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.is_htmx: boolTrue if the request was triggered by HTMX in the browser (HX-Request: true).
trigger: Option<String>The ID of the triggered element if sent by HTMX (HX-Trigger).
target: Option<String>The ID of the target element if sent by HTMX (HX-Target).
prompt: Option<String>The user response inputted into the prompt if sent by HTMX (HX-Prompt).
current_url: Option<String>The browser’s active URL when the request was initiated (HX-Current-URL).
Trait Implementations§
Source§impl Clone for HtmxRequest
impl Clone for HtmxRequest
Source§fn clone(&self) -> HtmxRequest
fn clone(&self) -> HtmxRequest
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HtmxRequest
impl Debug for HtmxRequest
Source§impl<S> FromRequestParts<S> for HtmxRequest
impl<S> FromRequestParts<S> for HtmxRequest
Source§type Rejection = !
type Rejection = !
If the extractor fails it’ll use this “rejection” type. A rejection is
a kind of error that can be converted into a response.
Source§async fn from_request_parts(
parts: &mut Parts,
_state: &S,
) -> Result<HtmxRequest, <HtmxRequest as FromRequestParts<S>>::Rejection>
async fn from_request_parts( parts: &mut Parts, _state: &S, ) -> Result<HtmxRequest, <HtmxRequest as FromRequestParts<S>>::Rejection>
Perform the extraction.
Auto Trait Implementations§
impl Freeze for HtmxRequest
impl RefUnwindSafe for HtmxRequest
impl Send for HtmxRequest
impl Sync for HtmxRequest
impl Unpin for HtmxRequest
impl UnsafeUnpin for HtmxRequest
impl UnwindSafe for HtmxRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S, T> FromRequest<S, ViaParts> for T
impl<S, T> FromRequest<S, ViaParts> for T
Source§type Rejection = <T as FromRequestParts<S>>::Rejection
type Rejection = <T as FromRequestParts<S>>::Rejection
If the extractor fails it’ll use this “rejection” type. A rejection is
a kind of error that can be converted into a response.
Source§fn from_request(
req: Request<Body>,
state: &S,
) -> impl Future<Output = Result<T, <T as FromRequest<S, ViaParts>>::Rejection>>
fn from_request( req: Request<Body>, state: &S, ) -> impl Future<Output = Result<T, <T as FromRequest<S, ViaParts>>::Rejection>>
Perform the extraction.
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more