Trait idna::punycode::PunycodeCaller

source ·
pub(crate) trait PunycodeCaller {
    const EXTERNAL_CALLER: bool;
}
Expand description

Marker for internal vs. external caller to retain old API behavior while tweaking behavior for internal callers.

External callers need overflow checks when encoding, but internal callers don’t, because PUNYCODE_ENCODE_MAX_INPUT_LENGTH is set to 1000, and per RFC 3492 section 6.4, the integer variable does not need to be able to represent values larger than (char::MAX - INITIAL_N) * (PUNYCODE_ENCODE_MAX_INPUT_LENGTH + 1), which is less than u32::MAX.

External callers need to handle upper-case ASCII when decoding, but internal callers don’t, because the internal code calls the decoder only with lower-case inputs.

Required Associated Constants§

Object Safety§

This trait is not object safe.

Implementors§