Function calcSizeForSlice [src]

Return the exact decoded size for a slice. InvalidPadding is returned if the input length is not valid.

Prototype

pub fn calcSizeForSlice(decoder: *const Base64Decoder, source: []const u8) Error!usize

Parameters

decoder: *const Base64Decodersource: []const u8

Possible Errors

InvalidCharacter
InvalidPadding
NoSpaceLeft

Source

pub fn calcSizeForSlice(decoder: *const Base64Decoder, source: []const u8) Error!usize { const source_len = source.len; var result = try decoder.calcSizeUpperBound(source_len); if (decoder.pad_char) |pad_char| { if (source_len >= 1 and source[source_len - 1] == pad_char) result -= 1; if (source_len >= 2 and source[source_len - 2] == pad_char) result -= 1; } return result; }