[−][src]Struct pct_str::PctString
Owned, mutable percent-encoded string.
This is the equivalent of String
for percent-encoded strings.
It implements Deref
to PctStr
meaning that all methods on PctStr
slices are
available on PctString
values as well.
Implementations
impl PctString
[src]
pub fn new<S: AsRef<str> + ?Sized>(str: &S) -> Result<PctString>
[src]
Create a new owned percent-encoded string.
The input slice is checked for correct percent-encoding and copied.
If the test fails, a InvalidEncoding
error is returned.
pub fn encode<I: Iterator<Item = char>, E: Encoder>(
src: I,
encoder: E
) -> PctString
[src]
src: I,
encoder: E
) -> PctString
Encode a string into a percent-encoded string.
This function takes an Encoder
instance to decide which character of the string must
be encoded.
Example
use pct_str::{PctString, URIReserved}; let pct_string = PctString::encode("Hello World!".chars(), URIReserved); println!("{}", pct_string.as_str()); // => Hello World%21
pub fn as_pct_str(&self) -> &PctStr
[src]
Return this string as a borrowed percent-encoded string slice.
pub fn into_string(self) -> String
[src]
Return the internal string of the PctString
, consuming it
Methods from Deref<Target = PctStr>
pub fn len(&self) -> usize
[src]
Length of the string slice, in bytes.
Note that two percent-encoded strings with different lengths may represent the same string.
pub fn as_str(&self) -> &str
[src]
Get the underlying percent-encoded string slice.
pub fn chars(&self) -> Chars<'_>ⓘ
[src]
Iterate over the encoded characters of the string.
pub fn decode(&self) -> String
[src]
Decoding.
Return the string with the percent-encoded characters decoded.
Trait Implementations
impl Debug for PctString
[src]
impl Deref for PctString
[src]
impl Display for PctString
[src]
impl Eq for PctString
[src]
impl Hash for PctString
[src]
fn hash<H: Hasher>(&self, hasher: &mut H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<'_> PartialEq<&'_ str> for PctString
[src]
impl PartialEq<PctStr> for PctString
[src]
impl PartialEq<PctString> for PctStr
[src]
impl PartialEq<PctString> for PctString
[src]
impl PartialEq<str> for PctString
[src]
impl PartialOrd<PctStr> for PctString
[src]
fn partial_cmp(&self, other: &PctStr) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<PctString> for PctStr
[src]
fn partial_cmp(&self, other: &PctString) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<PctString> for PctString
[src]
Auto Trait Implementations
impl RefUnwindSafe for PctString
impl Send for PctString
impl Sync for PctString
impl Unpin for PctString
impl UnwindSafe for PctString
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,