craftytrickster / stubborn-io

io traits/structs for tokio that automatically recover from potential disconnections/interruptions
https://docs.rs/stubborn-io
MIT License
68 stars 17 forks source link

TCP implementation support generic ToSocketAddrs #10

Closed dangerousplay closed 4 years ago

craftytrickster commented 4 years ago

Thanks for the PR, I'll take a look at it after work. I see that it failed in CI due to a format failure, please run cargo fmt.

craftytrickster commented 4 years ago

I like the idea of having a generic ToSocketAddrs implementation, but, I do not like the fact that the user must explicitly provide the generic param. I wonder if this is another way to do this, but to have the type automatically inferred.

craftytrickster commented 4 years ago

There's actually an easy fix here.

If you go to the io.rs file and check the connect methods and replace the impl Borrow<C> with just C, and then you remove the line let ctor_arg = ctor_arg.borrow().clone(); it will work exactly as it did before. You can then remove the explicit &str from the connect function generic param.

Please make those changes and then make sure you format/clippy your changeset.

dangerousplay commented 4 years ago

Changed as you said. Thanks for the time.

craftytrickster commented 4 years ago

Thanks for help and the better flexibility with the ctor arg