pub fn canonicalize_in_place(encoded: &mut String) {
    let bytes = unsafe { encoded.as_bytes_mut() };
    let bytes_length = bytes.len();

    // Complete groups.
    for chunk_id in 0..(bytes_length / 11) {
        let position = chunk_id * 11;
        let chunk = &mut bytes[position..position + 11];
        let decoded = decoding::compute_chunk(chunk);
        let encoded = encoding::compute_chunk(&decoded);

        bytes[position..(position + 11)].clone_from_slice(&encoded[position..(position + 11)]);
    }

    // Last incomplete group.
    let last_group_length = bytes_length - (bytes_length / 11 * 11);
    if last_group_length != 0 {
        let chunk = &mut bytes[bytes_length - last_group_length..];
        let decoded = decoding::compute_chunk(chunk);
        let elements_to_write = decoding::compute_decoded_size(last_group_length);
        let encoded = encoding::compute_chunk(&decoded[..elements_to_write]);

        bytes[(bytes_length - last_group_length)..bytes_length]
            .clone_from_slice(&encoded[(bytes_length - last_group_length)..bytes_length]);
    }
}
/// This method assumes `encoded` is correct.
This method assumes `encoded` is correct.
This method assumes ` encoded ` is correct .
pub fn canonicalize_in_place(encoded: &mut String) {
    let bytes = unsafe { encoded.as_bytes_mut() };
    let bytes_length = bytes.len();
    // Complete groups.
    for chunk_id in 0..(bytes_length / 11) {
        let position = chunk_id * 11;
        let chunk = &mut bytes[position..position + 11];
        let decoded = decoding::compute_chunk(chunk);
        let encoded = encoding::compute_chunk(&decoded);
        bytes[position..(position + 11)].clone_from_slice(&encoded[position..(position + 11)]);
    }
    // Last incomplete group.
    let last_group_length = bytes_length - (bytes_length / 11 * 11);
    if last_group_length != 0 {
        let chunk = &mut bytes[bytes_length - last_group_length..];
        let decoded = decoding::compute_chunk(chunk);
        let elements_to_write = decoding::compute_decoded_size(last_group_length);
        let encoded = encoding::compute_chunk(&decoded[..elements_to_write]);
        bytes[(bytes_length - last_group_length)..bytes_length]
            .clone_from_slice(&encoded[(bytes_length - last_group_length)..bytes_length]);
    }
}
pub fn canonicalize_in_place ( encoded : & mut String ) { let bytes = unsafe { encoded . as_bytes_mut ( ) } ; let bytes_length = bytes . len ( ) ; // Complete groups. for chunk_id in 0 .. ( bytes_length / 11 ) { let position = chunk_id * 11 ; let chunk = & mut bytes [ position .. position + 11 ] ; let decoded = decoding :: compute_chunk ( chunk ) ; let encoded = encoding :: compute_chunk ( & decoded ) ; bytes [ position .. ( position + 11 ) ] . clone_from_slice ( & encoded [ position .. ( position + 11 ) ] ) ; } // Last incomplete group. let last_group_length = bytes_length - ( bytes_length / 11 * 11 ) ; if last_group_length != 0 { let chunk = & mut bytes [ bytes_length - last_group_length .. ] ; let decoded = decoding :: compute_chunk ( chunk ) ; let elements_to_write = decoding :: compute_decoded_size ( last_group_length ) ; let encoded = encoding :: compute_chunk ( & decoded [ .. elements_to_write ] ) ; bytes [ ( bytes_length - last_group_length ) .. bytes_length ] . clone_from_slice ( & encoded [ ( bytes_length - last_group_length ) .. bytes_length ] ) ; } }
This method assumes `encoded` is correct.
This method assumes ` encoded ` is correct .
encoded
&mut String
encoded
&mut String