pub fn create_raw_dict_from_source<R: Read, W: Write>(
source: R,
source_size: usize,
output: &mut W,
dict_size: usize,
) -> Result<()>Available on crate feature
dict_builder only.Expand description
Read from source to create a “raw content” dictionary of dict_size.
The completed dictionary is written to output.
sourcewill be used as training data for the entire dictionary.source_sizeis used only as a preallocation hint before readingsourceand does not affect sampling once all data has been buffered.outputis where the completed dictionary will be written.dict_sizedetermines how large the complete dictionary should be. The completed dictionary will be this size or smaller.
This function reads the entire source into an in-memory Vec<u8> before building
the dictionary. The provided reader need not be buffered, but callers should avoid
sources too large to fit comfortably in memory.
§API note
This public API returns io::Result<()> and propagates source/output I/O failures.