Struct DatastarRequest
#[non_exhaustive]pub struct DatastarRequest;Available on crate features
http and std only.Expand description
Datastar-Request header, sent by the ๐ Datastar
client on every request it makes (e.g. through @get or @post actions).
Servers use it to tell Datastar fetches apart from regular browser
navigations, e.g. to reply with a 401 instead of a redirect
to a sign-in page, or to only read Datastar signals when present.
Datastar always sends the value true, but this header is treated as a
presence marker: decoding succeeds for any value, as the mere presence of
the header is what identifies a Datastar request. Encoding always writes true.
ยงExample values
- โtrueโ
ยงExamples
use rama_http_headers::{DatastarRequest, HeaderMapExt};
use rama_http_types::HeaderMap;
let mut headers = HeaderMap::new();
assert!(headers.typed_get::<DatastarRequest>().is_none());
headers.typed_insert(DatastarRequest::new());
assert!(headers.typed_get::<DatastarRequest>().is_some());Implementationsยง
ยงimpl DatastarRequest
impl DatastarRequest
pub fn new() -> DatastarRequest
pub fn new() -> DatastarRequest
Create a new DatastarRequest typed header.
Trait Implementationsยง
ยงimpl Clone for DatastarRequest
impl Clone for DatastarRequest
ยงfn clone(&self) -> DatastarRequest
fn clone(&self) -> DatastarRequest
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 moreimpl Copy for DatastarRequest
ยงimpl Debug for DatastarRequest
impl Debug for DatastarRequest
ยงimpl Default for DatastarRequest
impl Default for DatastarRequest
ยงfn default() -> DatastarRequest
fn default() -> DatastarRequest
Returns the โdefault valueโ for a type. Read more
impl Eq for DatastarRequest
ยงimpl HeaderDecode for DatastarRequest
impl HeaderDecode for DatastarRequest
ยงfn decode<'i, I>(values: &mut I) -> Result<DatastarRequest, Error>where
I: Iterator<Item = &'i HeaderValue>,
fn decode<'i, I>(values: &mut I) -> Result<DatastarRequest, Error>where
I: Iterator<Item = &'i HeaderValue>,
Decode this type from an iterator of
HeaderValues.ยงimpl HeaderEncode for DatastarRequest
impl HeaderEncode for DatastarRequest
ยงfn encode<E>(&self, values: &mut E)where
E: Extend<HeaderValue>,
fn encode<E>(&self, values: &mut E)where
E: Extend<HeaderValue>,
Encode this type to a
HeaderValue, and add it to a container
which has HeaderValue type as each element. Read moreยงfn encode_to_value(&self) -> Option<HeaderValue>
fn encode_to_value(&self) -> Option<HeaderValue>
Encode this header to
HeaderValue. Read moreยงimpl PartialEq for DatastarRequest
impl PartialEq for DatastarRequest
impl StructuralPartialEq for DatastarRequest
ยงimpl TypedHeader for DatastarRequest
impl TypedHeader for DatastarRequest
ยงfn name() -> &'static HeaderName
fn name() -> &'static HeaderName
The name of this header.
Auto Trait Implementationsยง
impl Freeze for DatastarRequest
impl RefUnwindSafe for DatastarRequest
impl Send for DatastarRequest
impl Sync for DatastarRequest
impl Unpin for DatastarRequest
impl UnsafeUnpin for DatastarRequest
impl UnwindSafe for DatastarRequest
Blanket Implementationsยง
ยงimpl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
ยงimpl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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,
ยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
ยงfn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
ยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
ยงfn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.ยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
ยงfn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
ยงimpl<T> FutureExt for T
impl<T> FutureExt for T
ยงfn with_context(self, otel_cx: Context) -> WithContext<Self> โ
fn with_context(self, otel_cx: Context) -> WithContext<Self> โ
ยงfn with_current_context(self) -> WithContext<Self> โ
fn with_current_context(self) -> WithContext<Self> โ
ยงimpl<T> Instrument for T
impl<T> Instrument for T
ยงfn instrument(self, span: Span) -> Instrumented<Self> โ
fn instrument(self, span: Span) -> Instrumented<Self> โ
ยง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ยงimpl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
ยงfn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a rama_grpc::Requestยงimpl<T> Pointable for T
impl<T> Pointable for T
ยงimpl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
ยงfn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Create a new
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more