Description
This pr attempts to simplify the r2pipe.rs code by replacing all the variants of the of R2pipe with a single Box that contains a dyn Pipe (pub struct R2Pipe(Box<dyn Pipe>);). This removes the need for the get_pipe method and shaves off about 14 lines of code. On the other hand, This PR may or may not break some code because the R2Pipe enum was public (and so is the new R2pipe struct) so the variants were public too.
If this PR is going to cause problems, it would be with R2PipeSpawn because as far as I can tell it is the only struct that has an impl block not for the Pipe trait.
Checklist
Description This pr attempts to simplify the r2pipe.rs code by replacing all the variants of the of
R2pipe
with a singleBox
that contains adyn Pipe
(pub struct R2Pipe(Box<dyn Pipe>);
). This removes the need for theget_pipe
method and shaves off about 14 lines of code. On the other hand, This PR may or may not break some code because theR2Pipe
enum was public (and so is the newR2pipe
struct) so the variants were public too. If this PR is going to cause problems, it would be withR2PipeSpawn
because as far as I can tell it is the only struct that has an impl block not for the Pipe trait.