Skip to main content

transcode_detected

Function transcode_detected 

Source
pub fn transcode_detected(
    bytes: &[u8],
    detected: DetectedEncoding,
    target: TargetEncoding,
) -> Result<TranscodeOutcome, ForgeError>
Expand description

Transcode with a pre-computed detection verdict.

Fast path: Utf8 → utf-8 returns TranscodeOutcome::Unchanged with zero allocation. Otherwise strict-decode, encode, and compare: a byte-identical result is reported as Unchanged so callers skip the write (invariants #5 and #10).