pub struct Scheme { /* private fields */ }
Expand description
Represents the scheme component of a URI
Implementations§
source§impl Scheme
impl Scheme
sourcepub const HTTP: Scheme = Scheme{ inner: Scheme2::Standard(Protocol::Http),}
pub const HTTP: Scheme = Scheme{ inner: Scheme2::Standard(Protocol::Http),}
HTTP protocol scheme
sourcepub const HTTPS: Scheme = Scheme{ inner: Scheme2::Standard(Protocol::Https),}
pub const HTTPS: Scheme = Scheme{ inner: Scheme2::Standard(Protocol::Https),}
HTTP protocol over TLS.
Attempt to convert a Scheme
from Bytes
This function will be replaced by a TryFrom
implementation once the
trait lands in stable.
Examples
extern crate bytes;
use bytes::Bytes;
let bytes = Bytes::from("http");
let scheme = Scheme::from_shared(bytes).unwrap();
assert_eq!(scheme.as_str(), "http");
sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Return a str representation of the scheme
Examples
let scheme: Scheme = "http".parse().unwrap();
assert_eq!(scheme.as_str(), "http");
sourcepub fn into_bytes(self) -> Bytes
pub fn into_bytes(self) -> Bytes
Converts this Scheme
back to a sequence of bytes
Trait Implementations§
source§impl<'a> HttpTryFrom<&'a [u8]> for Scheme
impl<'a> HttpTryFrom<&'a [u8]> for Scheme
§type Error = InvalidUri
type Error = InvalidUri
Associated error with the conversion this implementation represents.
source§impl<'a> HttpTryFrom<&'a str> for Scheme
impl<'a> HttpTryFrom<&'a str> for Scheme
§type Error = InvalidUri
type Error = InvalidUri
Associated error with the conversion this implementation represents.
source§impl HttpTryFrom<Bytes> for Scheme
impl HttpTryFrom<Bytes> for Scheme
§type Error = InvalidUriBytes
type Error = InvalidUriBytes
Associated error with the conversion this implementation represents.
source§impl HttpTryFrom<Scheme> for Scheme
impl HttpTryFrom<Scheme> for Scheme
source§impl PartialEq<Scheme> for str
impl PartialEq<Scheme> for str
Case-insensitive equality
source§impl PartialEq<str> for Scheme
impl PartialEq<str> for Scheme
Case-insensitive equality
Examples
let scheme: Scheme = "HTTP".parse().unwrap();
assert_eq!(scheme, *"http");
impl Eq for Scheme
Auto Trait Implementations§
impl RefUnwindSafe for Scheme
impl Send for Scheme
impl Sync for Scheme
impl Unpin for Scheme
impl UnwindSafe for Scheme
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> IntoSql for T
impl<T> IntoSql for T
source§fn into_sql<T>(self) -> Self::Expressionwhere
Self: AsExpression<T> + Sized,
fn into_sql<T>(self) -> Self::Expressionwhere
Self: AsExpression<T> + Sized,
Convert
self
to an expression for Diesel’s query builder. Read moresource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
Convert
&self
to an expression for Diesel’s query builder. Read more