pub fn encoded_size(bytes_len: usize, config: Config) -> Option<usize> {
    let rem = bytes_len % 3;

    let complete_input_chunks = bytes_len / 3;
    let complete_chunk_output = complete_input_chunks.checked_mul(4);

    if rem > 0 {
        if config.pad {
            complete_chunk_output.and_then(|c| c.checked_add(4))
        } else {
            let encoded_rem = match rem {
                1 => 2,
                2 => 3,
                _ => unreachable!("Impossible remainder"),
            };
            complete_chunk_output.and_then(|c| c.checked_add(encoded_rem))
        }
    } else {
        complete_chunk_output
    }
}
/// calculate the base64 encoded string size, including padding if appropriate
calculate the base64 encoded string size, including padding if appropriate
calculate the base64 encoded string size including padding if appropriate
pub fn encoded_size(bytes_len: usize, config: Config) -> Option<usize> {
    let rem = bytes_len % 3;
    let complete_input_chunks = bytes_len / 3;
    let complete_chunk_output = complete_input_chunks.checked_mul(4);
    if rem > 0 {
        if config.pad {
            complete_chunk_output.and_then(|c| c.checked_add(4))
        } else {
            let encoded_rem = match rem {
                1 => 2,
                2 => 3,
                _ => unreachable!("Impossible remainder"),
            };
            complete_chunk_output.and_then(|c| c.checked_add(encoded_rem))
        }
    } else {
        complete_chunk_output
    }
}
pub fn encoded_size ( bytes_len : usize , config : Config ) -> Option < usize > { let rem = bytes_len % 3 ; let complete_input_chunks = bytes_len / 3 ; let complete_chunk_output = complete_input_chunks . checked_mul ( 4 ) ; if rem > 0 { if config . pad { complete_chunk_output . and_then ( | c | c . checked_add ( 4 ) ) } else { let encoded_rem = match rem { 1 => 2 , 2 => 3 , _ => unreachable ! ( " " ) , } ; complete_chunk_output . and_then ( | c | c . checked_add ( encoded_rem ) ) } } else { complete_chunk_output } }
calculate the base64 encoded string size, including padding if appropriate
calculate the base64 encoded string size including padding if appropriate
bytes_len
usize
config
Config
bytes_len
usize
config
Config