Skip to main content

character_for

Function character_for 

Source
pub fn character_for<V: Source>(
    kind: PrimitiveKind,
    value: &V,
    path: &str,
) -> Result<char, ProbeError>
Expand description

Exactly one character, of a width that can carry it.

The width check belongs beside integer_for’s range check and for the same reason: a char holding š is a value file that says something the type cannot hold, and the two C emitters wrote '\u{161}' into a one-byte field where the compiler narrows it without a word. DDS-XTypes 1.3 §7.2.2.2.1.2.2 gives CHAR_8_TYPE eight bits and no encoding; §7.2.2.2.1.2.5 restricts CHAR_16_TYPE to the Basic Multilingual Plane, “Unicode codepoints from 0x0000 to U+FFFF”.

§Errors

ProbeError::Mismatch.