[−][src]Trait async_coap::uri::escape::StrExt
Trait for str
adding URI percent encoding/decoding
See the module-level documentation for more details.
Required methods
ⓘImportant traits for EscapeUri<'a, X>fn escape_uri(&self) -> EscapeUri<EscapeUriSegment>
Gets an iterator that performs general-purpose URI percent-encoding.
By default, all characters described by [IETF-RFC3986
] as pchar
s will be escaped,
which is appropriate for escaping path segments.
This behavior can be modified by appending the following modifiers:
full()
: Escapes all characters except those which areunreserved
.for_query()
: Escaping appropriate for the query component.for_fragment()
: Escaping appropriate for the fragment component.
The returned iterator will escape ASCII control characters.
ⓘImportant traits for UnescapeUri<'a>fn unescape_uri(&self) -> UnescapeUri
Gets an iterator that performs URI percent-decoding.
By default, when the iterator encounters an error the behavior is as follows:
- Unescaped ASCII control codes are dropped.
- Escaped ASCII control codes are converted to Unicode Control Pictures (i.e.
%00
=>␀
) - Bad percent-escape sequences (like
"%Foo"
) are replaced withU+FFFD REPLACEMENT CHARACTER
- Incomplete UTF8 sequences (like
"%E2%82"
) are replaced withU+FFFD REPLACEMENT CHARACTER
- Invalid UTF8 sequences (like
"%E2%82%E2"
) are replaced withU+FFFD REPLACEMENT CHARACTER
fn unescape_uri_in_place(&mut self) -> &mut str
Experimental: Unescapes the given mutable string in-place, returning a subset of the mutable slice even if it contains encoding errors or illegal characters.
The behavior upon encountering errors is identical to that of
unescape_uri()
.