Skip to main content

encode_with_lookup

Function encode_with_lookup 

Source
pub fn encode_with_lookup<F>(
    decomp: &DecompRef<'_>,
    lookup: F,
    out: &mut [u8; 4],
) -> Result<usize, EncodeError>
where F: Fn(char) -> Option<u8>,
Expand description

Encode a decomposition using the supplied 字根 lookup. Writes the code bytes into out and returns the number of bytes written (3 or 4).

The encoder is the ONLY entry point that runs the rules; all platform glue (PHF runtime tables, HashMap build-time tables) goes through here via the lookup closure.