I'm having some issues with a recent project of mine.
Here's the intro: I got a
Data object and I want to generate an "infinite"
Stream for it. This stream is generated by a
Calculator object (which returns the
impl Stream<Data>) and applies a
Filter logic over it before returning the
Filter is reaching out to external sources (e.g. webservices), thus the signature is similar to:
fn filter(&self, data: &Data) -> BoxFuture<Result<bool, SomeError>>;
I've recreated this example in the Playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=1e9e6d0b354c9f0a30223ab2bdc75ea7
Two problems I'm having:
Lifetimes: for some reason, I can't call the
Filter::filterfunction from the
Calculatordue to some lifetime mismatches (I guess due to
Early stop: is there a way to bubble-up the
Calculatorcaller? Ideally, I'd like for the whole operation to fail if