pub struct Scheme { /* private fields */ }
Expand description
Represents the scheme component of a URI
Implementations
sourceimpl Scheme
impl Scheme
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
sourceimpl<'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.
sourceimpl<'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.
sourceimpl HttpTryFrom<Bytes> for Scheme
impl HttpTryFrom<Bytes> for Scheme
type Error = InvalidUriBytes
type Error = InvalidUriBytes
Associated error with the conversion this implementation represents.
sourceimpl HttpTryFrom<Scheme> for Scheme
impl HttpTryFrom<Scheme> for Scheme
sourceimpl 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more