Skip to main content

decode_whatwg_bytes

Function decode_whatwg_bytes 

Source
pub fn decode_whatwg_bytes(bytes: &[u8]) -> PercentDecodedWhatwgBytes<'_>
Expand description

Returns the result of percent-decode algorithm in the WHATWG URL Standard.

ยงExamples

use iri_string::percent_encode::decode::decode_whatwg_bytes;

let decoded = decode_whatwg_bytes(b"hello%20world");

assert_eq!(decoded.not_yet_decoded(), &b"hello%20world"[..]);

// This requires `alloc` feature since
// `into_bytes()` returns `Cow<'_, [u8]>`.
assert_eq!(decoded.into_bytes(), &b"hello world"[..]);