Struct actix_web_lab::header::XForwardedPrefix
source · pub struct XForwardedPrefix(pub PathAndQuery);Expand description
The X-Forwarded-Prefix header, defined in [RFC XXX §X.X].
The X-Forwarded-Prefix header field is used
Also see
§Example Values
//foo
§Examples
use actix_web::HttpResponse;
use actix_web_lab::header::XForwardedPrefix;
let mut builder = HttpResponse::Ok();
builder.insert_header(XForwardedPrefix("/bar".parse().unwrap()));Tuple Fields§
§0: PathAndQueryMethods from Deref<Target = PathAndQuery>§
sourcepub fn path(&self) -> &str
pub fn path(&self) -> &str
Returns the path component
The path component is case sensitive.
abc://username:password@example.com:123/path/data?key=value&key2=value2#fragid1
|--------|
|
path
If the URI is * then the path component is equal to *.
§Examples
let path_and_query: PathAndQuery = "/hello/world".parse().unwrap();
assert_eq!(path_and_query.path(), "/hello/world");sourcepub fn query(&self) -> Option<&str>
pub fn query(&self) -> Option<&str>
Returns the query string component
The query component contains non-hierarchical data that, along with data in the path component, serves to identify a resource within the scope of the URI’s scheme and naming authority (if any). The query component is indicated by the first question mark (“?”) character and terminated by a number sign (“#”) character or by the end of the URI.
abc://username:password@example.com:123/path/data?key=value&key2=value2#fragid1
|-------------------|
|
query
§Examples
With a query string component
let path_and_query: PathAndQuery = "/hello/world?key=value&foo=bar".parse().unwrap();
assert_eq!(path_and_query.query(), Some("key=value&foo=bar"));Without a query string component
let path_and_query: PathAndQuery = "/hello/world".parse().unwrap();
assert!(path_and_query.query().is_none());sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Returns the path and query as a string component.
§Examples
With a query string component
let path_and_query: PathAndQuery = "/hello/world?key=value&foo=bar".parse().unwrap();
assert_eq!(path_and_query.as_str(), "/hello/world?key=value&foo=bar");Without a query string component
let path_and_query: PathAndQuery = "/hello/world".parse().unwrap();
assert_eq!(path_and_query.as_str(), "/hello/world");Trait Implementations§
source§impl Clone for XForwardedPrefix
impl Clone for XForwardedPrefix
source§fn clone(&self) -> XForwardedPrefix
fn clone(&self) -> XForwardedPrefix
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for XForwardedPrefix
impl Debug for XForwardedPrefix
source§impl Deref for XForwardedPrefix
impl Deref for XForwardedPrefix
source§impl DerefMut for XForwardedPrefix
impl DerefMut for XForwardedPrefix
source§impl Display for XForwardedPrefix
impl Display for XForwardedPrefix
source§impl Header for XForwardedPrefix
impl Header for XForwardedPrefix
source§fn name() -> HeaderName
fn name() -> HeaderName
source§fn parse<M: HttpMessage>(msg: &M) -> Result<Self, ParseError>
fn parse<M: HttpMessage>(msg: &M) -> Result<Self, ParseError>
source§impl PartialEq for XForwardedPrefix
impl PartialEq for XForwardedPrefix
source§fn eq(&self, other: &XForwardedPrefix) -> bool
fn eq(&self, other: &XForwardedPrefix) -> bool
self and other values to be equal, and is used
by ==.source§impl TryIntoHeaderValue for XForwardedPrefix
impl TryIntoHeaderValue for XForwardedPrefix
§type Error = InvalidHeaderValue
type Error = InvalidHeaderValue
source§fn try_into_value(self) -> Result<HeaderValue, Self::Error>
fn try_into_value(self) -> Result<HeaderValue, Self::Error>
impl Eq for XForwardedPrefix
impl StructuralEq for XForwardedPrefix
impl StructuralPartialEq for XForwardedPrefix
Auto Trait Implementations§
impl RefUnwindSafe for XForwardedPrefix
impl Send for XForwardedPrefix
impl Sync for XForwardedPrefix
impl Unpin for XForwardedPrefix
impl UnwindSafe for XForwardedPrefix
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
§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<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.