Closed gmacon closed 2 years ago
I'm not sure I totally follow the idea. We didn't hit 1.0.0, while I don't think we should change everything, small or medium change are ok for me.
Maybe I can help with what I think the usage would look like:
let dead_capture = Capture::dead_with_options(Linktype::ETHERNET)
.precision(Precision::Nano)
.snaplen(60)
.activate()?;
so builder pattern with the link type required and the precision and snaplen optional.
Currently,
Capture::dead
callspcap_open_dead
, but there should be a way to callpcap_open_dead_with_tstamp_precision
instead. I propose adding a newCapture::dead_with_precision
function to handle that.Aside: If I were designing the API from scratch, I might have a separate
DeadCaptureBuilder
that provides default values for thesnaplen
andprecision
and lets you set either or both before finally callingpcap_open_dead_with_tstamp_precision
at the end. Would there be any objection to such an API?