Open
Description
The code has been pushed in early stage and i'm a beginner in rust, so I'm sure there is a plenty of room for improvement.
I didn't want to overengineer the codebase for such a simple usecase, but some part can be improve and discuss:
- There is a lot of long function in
main.rs
like here https://github.com/tchapacan/livebox-exporter-rs/blob/main/src/main.rs#L176-L199 (and elsewhere as well) - This part work as intended but the implementation can be a little naive: https://github.com/tchapacan/livebox-exporter-rs/blob/main/src/main.rs#L124-L162
Seek if we can use leverage a proper datastructure / type and iterate through it to pass parameter while using the querying method?
-
In
client.rs
separate the logic of building the different type of query (post, post_authenticated, login, logout) and the actual query to retrieve metrics (get_wan_config, get_status, get_devices, etc..), some how like aservice <==> adapter
"pattern" -
If you are confident enough in rust, dig deeper in the structure of the project (module, trait, "class") etc