Skip to main content

encode_with

Function encode_with 

Source
pub fn encode_with(
    input: &[u8],
    limits: Limits,
    force: Option<CandidateKind>,
) -> Result<(Vec<u8>, EncodeReport)>
Expand description

Encode input exactly, optionally forcing a single candidate family.

With force == None this is the ordinary complete-cost court over every proposed candidate. With force == Some(kind) the candidate set is first filtered to proposals of exactly that kind, then the same court runs over the filtered set: the forced lane is still serialized, decoded, and byte-compared before it may be returned, so forcing never weakens exactness and determinism.

Returns Error::usage when force names a kind that this input does not propose (for example PDF_CHANNELS on a non-PDF, or BYTE_RANS on empty input), rather than silently substituting another lane. That failure is the honest signal that the mechanism does not apply.