• Niklas Adolfsson's avatar
    feat: add `SubscriptionSink::pipe_from_try_stream` to support streams that returns `Result` (#720) · 545ceaf6
    Niklas Adolfsson authored
    
    
    * refactor: make `pipe_from_stream` take stream of result
    
    The rationale for this is that it is more flexible for use cases when `Stream<Item = Result<T, Error>>`.
    
    Take for example `tokio_stream::Broadcast` then one would have to something like:
    
    ```rust
       let stream = BroadcastStream::new(rx).take_while(|r| future::ready(r.is_ok())).filter_map(|r| future::ready(r.ok()));
    ```
    
    Of course it's a bit awkward to return `Result` when the underlying stream can't fail but I think that's fair trade-off
    here.
    
    * Update core/src/server/rpc_module.rs
    
    Co-authored-by: default avatarTarik Gul <[email protected]>
    
    * pipe_from_stream: make E: Display instead of StdError
    
    * add a test
    
    * add `pipe_from_try_stream` API to support `TryStream`
    
    * Update tests/tests/integration_tests.rs
    
    * Update proc-macros/src/lib.rs
    
    Co-authored-by: default avatarTarik Gul <[email protected]>
    545ceaf6