containerd / ttrpc-rust

Rust implementation of ttrpc (GRPC for low-memory environments)
Apache License 2.0
195 stars 45 forks source link

ClientStream.split exposes private types #195

Closed powturns closed 1 year ago

powturns commented 1 year ago

Description of problem

The current implementation:

ClientStream {
    pub fn split(self) -> (CSSender<Q>, CSReceiver<P>) {
        (self.tx, self.rx)
    }
}

returns CSSender and CSReceiver, which are not public / re-exported in the asynchronous module. This is fine if the sender/receiver are only used locally, but prevents them from being passed to a function / stored in a struct.

Expected result

The types returned by split can be passed to functions / structs.

Actual result

Compile error:

20 | use ttrpc::asynchronous::stream::{CSSender, CSReceiver};
   |                          ^^^^^^ private module
   |

or

21 | use ttrpc::asynchronous::{CSSender, CSReceiver};
   |                           ^^^^^^^^  ^^^^^^^^^^ no `CSReceiver` in `asynchronous`
   |                           |
   |                           no `CSSender` in `asynchronous`