DoxigAlpha

decoderWithIgnore

Creates a new decoder that ignores certain characters.

Function parameters

Parameters

#
ignore_chars:[]const u8

(best-effort) constant time hexadecimal encoding and decoding.

Types

#
hex
(best-effort) constant time hexadecimal encoding and decoding.
base64
(best-effort) constant time base64 encoding and decoding.

Error sets in this namespace

Error Sets

#

Source

Implementation

#
pub fn decoderWithIgnore(ignore_chars: []const u8) error{InvalidCharacter}!DecoderWithIgnore {
    var ignored_chars = StaticBitSet(256).initEmpty();
    for (ignore_chars) |c| {
        switch (c) {
            'A'...'Z', 'a'...'z', '0'...'9' => return error.InvalidCharacter,
            else => if (ignored_chars.isSet(c)) return error.InvalidCharacter,
        }
        ignored_chars.set(c);
    }
    return DecoderWithIgnore{ .ignored_chars = ignored_chars };
}