Closed dorak88783 closed 3 years ago
I added a testnet moethod and added futures.
It didn't look much nicer with &str
instead of String
, since the Client
struct also uses String
, so you'd have to convert somewhere anyway, so I kept it like it was.
I'm finished coding; it works fine for me like this. I'd appreciate feedback.
@dorak88783 I think new_with_config is a good start. We can get some feedback when people start using it and we make it the default way in a near future. I am aware that we have a design issue with &str and String. When I created this project I was starting in the Rust world. It can be improved.
Thanks! It is an impressive project for somebody starting with Rust :)
The &str
vs String
is not a big deal for me ; it's just nicer to be able write .set_rest_api_endpoint("https://testnet.binance.vision/api")
instead of .set_rest_api_endpoint("https://testnet.binance.vision/api".into())
. In terms of performance it doesn't matter that much...
I also thought about adding the API key and API secret to the config/builder pattern, but decided not to do this yet. Maybe this all can be unified in a future (API breaking) version.
Ah I could fix the syntax using this Into<String>
type.
Maybe a String
is a good type for Config
and Client
anyway as it's clear that they own this.
@dorak88783 I just finished the tests. It seems to work fine. Merging it now. Thank you for the contribution.
Why can't I access both new_with_config
and Config
struct from current crate ? Is it still hidden ?
To solve https://github.com/wisespace-io/binance-rs/issues/61 and https://github.com/wisespace-io/binance-rs/issues/74, we need a
Config
struct. This was my first attempt to make one.I made a new
new_with_config
function in theBinance
trait. We could also change the signature of the existingnew
function, but that would be an API breaking change. @wisespace-io: Please let me know what you think is best.This PR was for early feedback, what I want to do for sure is:
&str
types instead ofString
, but I need to learn a bit more Rust to do this.All feedback welcome!