bovee / entab

* -> TSV
MIT License
21 stars 5 forks source link

Flexible Param input #24

Closed bovee closed 2 years ago

bovee commented 2 years ago

A lot of parser states are parameterized. For example, both #12 and #13 require a file name so we can open another ReadBuffer to store in the state, TSV/CSV parsers can take delimiters and number of header lines, and kmer-parsers need a k.

Right now, we pass initial params into the state as a "P" object scoped to each state which we also require to have a Default so that we can use None across parsers. An alternate design could take an Into<P> object where P: Default + From<Params> for convenience (where Params is some kind of { filename: String, other_params: BTreeMap<&str, Value> }?)

bovee commented 2 years ago

I ended up extending get_reader to support additional params that must be used (except for a filename param that gets inserted by default) in 5f72d0468c8c8d343370638020a9334b31e5d704.

Some alternate designs that didn't work: