-
-
Notifications
You must be signed in to change notification settings - Fork 11
Description
Thank you for your work on bgpkit-parser.
I am building on top of it bgpflux, a clone of bgpreader, and the experience is great!
I have however a minor ergonomic request about the filters and how they are bound to BgpkitParser.
Filter is already a public, well-designed type, but the only way to attach filters to a BgpkitParser is through add_filter(&str, &str). This means a parser's filter construction is always mediated through a parser instance: it's not possible to build a filter specification once in a Vec<Filter> independently and reuse it across multiple parsers, which is unfortunate because BgpkitParser already stores filters as Vec<Filter> internally.
Could you consider adding a method that accepts a pre-built Vec<Filter> directly, bypassing string re-parsing?
Something like:
impl<R> BgpkitParser<R> {
pub fn with_filters(self, filters: Vec<Filter>) -> Self {
BgpkitParser {
filters,
..self
}
}
}