pub unsafe fn decode_with_unchecked<'a>(s: &[u8], buf: &'a mut Vec<u8>) -> Option<&'a [u8]> {
    // Skip bytes that are not '%'.
    let i = match s.iter().position(|&x| x == b'%') {
        Some(i) => i,
        None => return None,
    };

    let start = buf.len();

    unsafe {
        // SAFETY: `i` cannot exceed `s.len()` since `i < s.len()`.
        copy(s, buf, i, false);
        // SAFETY: The caller must ensure that the string is properly encoded.
        _decode(s, i, buf, false).unwrap();
        // SAFETY: The length is non-decreasing.
        Some(buf.get_unchecked(start..))
    }
}
/// Decodes a percent-encoded string with a buffer assuming validity.
///
/// If the string needs no decoding, this function returns `None`
/// and no bytes will be appended to the buffer.
///
/// # Safety
///
/// This function does not check that the string is properly encoded.
/// Any invalid encoded octet in the string will result in undefined behavior.
Decodes a percent-encoded string with a buffer assuming validity.
If the string needs no decoding, this function returns `None`
and no bytes will be appended to the buffer.
Decodes a percent - encoded string with a buffer assuming validity . If the string needs no decoding this function returns ` None ` and no bytes will be appended to the buffer .
pub unsafe fn decode_with_unchecked<'a>(s: &[u8], buf: &'a mut Vec<u8>) -> Option<&'a [u8]> {
    // Skip bytes that are not '%'.
    let i = match s.iter().position(|&x| x == b'%') {
        Some(i) => i,
        None => return None,
    };
    let start = buf.len();
    unsafe {
        // SAFETY: `i` cannot exceed `s.len()` since `i < s.len()`.
        copy(s, buf, i, false);
        // SAFETY: The caller must ensure that the string is properly encoded.
        _decode(s, i, buf, false).unwrap();
        // SAFETY: The length is non-decreasing.
        Some(buf.get_unchecked(start..))
    }
}
pub unsafe fn decode_with_unchecked < ' a > ( s : & [ u8 ] , buf : & ' a mut Vec < u8 > ) -> Option < & ' a [ u8 ] > { // Skip bytes that are not '%'. let i = match s . iter ( ) . position ( | & x | x == b'%' ) { Some ( i ) => i , None => return None , } ; let start = buf . len ( ) ; unsafe { // SAFETY: `i` cannot exceed `s.len()` since `i < s.len()`. copy ( s , buf , i , false ) ; // SAFETY: The caller must ensure that the string is properly encoded. _decode ( s , i , buf , false ) . unwrap ( ) ; // SAFETY: The length is non-decreasing. Some ( buf . get_unchecked ( start .. ) ) } }
Decodes a percent-encoded string with a buffer assuming validity.
Decodes a percent - encoded string with a buffer assuming validity .
s
&[u8]
buf
&'a mut Vec<u8>
s
&[u8]
buf
&'a mut Vec<u8>
safety
This function does not check that the string is properly encoded.
Any invalid encoded octet in the string will result in undefined behavior.
This function does not check that the string is properly encoded . Any invalid encoded octet in the string will result in undefined behavior .