pub trait AsyncLineCollector<S: Sink>: Send + 'static {
// Required method
fn collect<'a>(
&'a mut self,
line: Cow<'a, str>,
sink: &'a mut S,
) -> impl Future<Output = Next> + Send + 'a;
}Expand description
An async collector for parsed output lines.
The collector itself may hold state via &mut self, but only the sink S is returned from
Consumer::wait or Consumer::cancel.
This uses a trait rather than std::ops::AsyncFn because stable Rust can express the lending
async callback shape, but cannot yet express the Send bound required on an AsyncFn
callback’s returned future for use inside tokio::spawn. Once that bound is expressible on
stable Rust, this API can move back toward async-closure ergonomics.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.