Struct ReasonPhrase
pub struct ReasonPhrase(/* private fields */);Expand description
A reason phrase in an HTTP/1 response.
§Clients
For clients, a ReasonPhrase will be present in the extensions of the http::Response returned
for a request if the reason phrase is different from the canonical reason phrase for the
response’s status code. For example, if a server returns HTTP/1.1 200 Awesome, the
ReasonPhrase will be present and contain Awesome, but if a server returns HTTP/1.1 200 OK,
the response will not contain a ReasonPhrase.
§Servers
When a ReasonPhrase is present in the extensions of the http::Response written by a server,
its contents will be written in place of the canonical reason phrase when responding via HTTP/1.
Implementations§
§impl ReasonPhrase
impl ReasonPhrase
pub const fn from_static(reason: &'static [u8]) -> ReasonPhrase
pub const fn from_static(reason: &'static [u8]) -> ReasonPhrase
Converts a static byte slice to a reason phrase.
pub unsafe fn from_bytes_unchecked(reason: Bytes) -> ReasonPhrase
pub unsafe fn from_bytes_unchecked(reason: Bytes) -> ReasonPhrase
Converts a Bytes directly into a ReasonPhrase without validating.
Use with care; invalid bytes in a reason phrase can cause serious security problems if emitted in a response.
§Safety
Given reason parameter is a valid “reason phrase”
Trait Implementations§
§impl AsRef<[u8]> for ReasonPhrase
impl AsRef<[u8]> for ReasonPhrase
§impl Clone for ReasonPhrase
impl Clone for ReasonPhrase
§fn clone(&self) -> ReasonPhrase
fn clone(&self) -> ReasonPhrase
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ReasonPhrase
impl Debug for ReasonPhrase
§impl From<ReasonPhrase> for Bytes
impl From<ReasonPhrase> for Bytes
§fn from(reason: ReasonPhrase) -> Bytes
fn from(reason: ReasonPhrase) -> Bytes
§impl Hash for ReasonPhrase
impl Hash for ReasonPhrase
§impl Ord for ReasonPhrase
impl Ord for ReasonPhrase
§impl PartialEq for ReasonPhrase
impl PartialEq for ReasonPhrase
§impl PartialOrd for ReasonPhrase
impl PartialOrd for ReasonPhrase
§impl TryFrom<&[u8]> for ReasonPhrase
impl TryFrom<&[u8]> for ReasonPhrase
§type Error = InvalidReasonPhrase
type Error = InvalidReasonPhrase
§fn try_from(
reason: &[u8],
) -> Result<ReasonPhrase, <ReasonPhrase as TryFrom<&[u8]>>::Error>
fn try_from( reason: &[u8], ) -> Result<ReasonPhrase, <ReasonPhrase as TryFrom<&[u8]>>::Error>
§impl TryFrom<Bytes> for ReasonPhrase
impl TryFrom<Bytes> for ReasonPhrase
§type Error = InvalidReasonPhrase
type Error = InvalidReasonPhrase
§fn try_from(
reason: Bytes,
) -> Result<ReasonPhrase, <ReasonPhrase as TryFrom<Bytes>>::Error>
fn try_from( reason: Bytes, ) -> Result<ReasonPhrase, <ReasonPhrase as TryFrom<Bytes>>::Error>
§impl TryFrom<String> for ReasonPhrase
impl TryFrom<String> for ReasonPhrase
§type Error = InvalidReasonPhrase
type Error = InvalidReasonPhrase
§fn try_from(
reason: String,
) -> Result<ReasonPhrase, <ReasonPhrase as TryFrom<String>>::Error>
fn try_from( reason: String, ) -> Result<ReasonPhrase, <ReasonPhrase as TryFrom<String>>::Error>
§impl TryFrom<Vec<u8>> for ReasonPhrase
impl TryFrom<Vec<u8>> for ReasonPhrase
§type Error = InvalidReasonPhrase
type Error = InvalidReasonPhrase
impl Eq for ReasonPhrase
impl StructuralPartialEq for ReasonPhrase
Auto Trait Implementations§
impl !Freeze for ReasonPhrase
impl RefUnwindSafe for ReasonPhrase
impl Send for ReasonPhrase
impl Sync for ReasonPhrase
impl Unpin for ReasonPhrase
impl UnwindSafe for ReasonPhrase
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§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
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
§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> ⓘ
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> ⓘ
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>
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>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more§impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
fn rama_try_from(value: T) -> Result<U, <U as RamaTryFrom<T>>::Error>
§impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
type Error = <U as RamaTryFrom<T, CrateMarker>>::Error
fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T, CrateMarker>>::Error>
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
self into the result. Lower case
letters are used (e.g. f9b4ca)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
self into the result. Upper case
letters are used (e.g. F9B4CA)