vax-r commented on issue #1873:
URL: https://github.com/apache/iggy/issues/1873#issuecomment-2984885313

   Hey @marvin-hansen , thanks for the comment !
   
   I do encountered some questions while tackling this issue.
   
   Since `IggyClient` relates to so many structs, e.g. `IggyClientBuilder` .
   They have to be adjust to be static dispatched as well.
   
   In the case for `IggyClientBuilder`, if I want to make it type-generic, 
it'll look something like
   ```
   #[derive(Debug, Default)]
   pub struct IggyClientBuilderV2<T> where T: Client + Default, {
       client: Option<T>,
       partitioner: Option<Arc<dyn Partitioner>>,
       encryptor: Option<Arc<EncryptorKind>>,
   }
   ```
   The problem is that now `T` should be known at compile-time, so I don't 
think putting `with_tcp()`, `with_quic()`, `with_http()` in the block of
   ```
   impl<T> IggyClientBuilderV2<T> where T: CLient + Default, {}
   ```
   is a sane decision.
   
   Maybe put them seperately in
   ```
   impl IggyClientBuilderV2<TcpClient> {
       pub fn with_tcp()...
   }
   
   impl IggyClientBuilderV2<QuicClient> {
       pub fn with_quic()...
   }
   ```
   is better?
   
   So is the problem for `from_connection_string()`, since `T` is one of 
`TcpClient`, `QuicClient`, `HttpClient` , we don't need the `match` block, we 
can put their separate implementation in the block I mentioned above.
   
   What do you think ?
   
   This is just 1 struct, I think many struct will encounter similar problem.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to