pub fn discover_zstd_dict_blocking(
origin: &str,
hash: &str,
) -> Result<Vec<u8>, ZstdDictDiscoveryError>Expand description
Synchronously resolve a zstd dictionary via
.well-known/codec/dicts/<hex>.zstd (v0.5+).
Fetches <origin>/.well-known/codec/dicts/<sha256-hex>.zstd, verifies the
fetched bytes hash to <hex>, and returns the raw dict bytes ready to
feed into zstd::dict::DecoderDictionary::copy(...) or equivalent.
§Example
use codec_rs::discover_zstd_dict_blocking;
let dict = discover_zstd_dict_blocking(
"https://codec.example",
"sha256:abc1230000000000000000000000000000000000000000000000000000000000",
)?;§Errors
ZstdDictDiscoveryError::InvalidHashif the hash is malformed (rejected before any HTTP request)ZstdDictDiscoveryError::NotFoundfor HTTP 404ZstdDictDiscoveryError::HashMismatchif origin served wrong bytesZstdDictDiscoveryError::Httpfor transport-layer failures