pub enum Decode<'a> {
Borrowed(&'a str),
Owned(Vec<u8>),
}
Expand description
A wrapper of percent-decoded bytes.
This enum is created by EStr::decode
.
Variants§
Borrowed(&'a str)
No percent-encoded octets are decoded.
Owned(Vec<u8>)
One or more percent-encoded octets are decoded.
Implementations§
source§impl<'a> Decode<'a>
impl<'a> Decode<'a>
sourcepub fn into_bytes(self) -> Cow<'a, [u8]>
pub fn into_bytes(self) -> Cow<'a, [u8]>
Consumes this Decode
and yields the underlying decoded bytes.
sourcepub fn into_string(self) -> Result<Cow<'a, str>, FromUtf8Error>
pub fn into_string(self) -> Result<Cow<'a, str>, FromUtf8Error>
sourcepub fn into_string_lossy(self) -> Cow<'a, str>
pub fn into_string_lossy(self) -> Cow<'a, str>
Converts the decoded bytes to a string, including invalid characters.
This calls String::from_utf8_lossy
if the bytes are not valid UTF-8.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Decode<'a>
impl<'a> RefUnwindSafe for Decode<'a>
impl<'a> Send for Decode<'a>
impl<'a> Sync for Decode<'a>
impl<'a> Unpin for Decode<'a>
impl<'a> UnwindSafe for Decode<'a>
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)