Skip to main content

accept_encoding_qualities

Function accept_encoding_qualities 

pub fn accept_encoding_qualities(
    accepted: &[QualityValue<Encoding>],
    wildcard_quality: Option<Quality>,
    supported: impl SupportedEncodings,
) -> impl Iterator<Item = QualityValue<Encoding>>
Available on crate features http and std only.
Expand description

Yields every encoding the server supports with the quality the client gives it.

This is the candidate set behind maybe_preferred_encoding_with_wildcard, for servers that have to fall back to a less preferred encoding when a variant turns out to be missing. An explicitly listed encoding takes its highest listed quality, an unlisted one takes the * wildcard quality. Without a wildcard an unlisted encoding is not acceptable, except Encoding::Identity (RFC 9110 §12.5.3, rule 2), which then takes the lowest non-zero quality so that any acceptable listed encoding is preferred over it.