pub fn check_cover_options(
options: &CoverOptions,
dict_size: usize,
) -> Result<()>Available on crate feature
dict-builder only.Expand description
Refuse COVER tuning no training run can use for a dict_size dictionary,
from the options alone: what train_cover_dict (both k and d given)
or optimize_cover_dict (either left zero) would refuse before reading a
sample. Lets a caller holding a large corpus fail before loading it.
§Errors
InvalidInput for tuning out of range or for a k and d that no
dictionary of dict_size bytes holds, where TrainingError::of reports
TrainingError::Parameter, and for a dict_size under
MIN_TRAINED_DICT_SIZE, where it reports
TrainingError::DictionaryTooSmall.
§Examples
use structured_zstd::dictionary::{CoverOptions, check_cover_options};
let fits = CoverOptions { k: 256, d: 8, ..CoverOptions::default() };
assert!(check_cover_options(&fits, 4096).is_ok());
let too_long = CoverOptions { k: 8192, d: 8, ..CoverOptions::default() };
assert!(check_cover_options(&too_long, 4096).is_err());