I am trying to write a library for interacting with a REST API from a government web service. The API has several endpoints, each with its own set of permissible parameters. The API is not fault tolerant, meaning that including an inappropriate parameter returns an error rather than being ignored. As such my goal is to leverage Rust's type safety to prevent those kinds of errors being possible.
I have an enum for the endpoints and then enums for each endpoint's possible parameters. My plan is to use a
with_params() method while building the request URL that will take the parameters of any endpoint type. I think the way to achieve that is using an empty trait and have each parameter type implement that trait. Then the signature for
fn with_params(self, params: Vec<T: Param>) -> URL. Does this make sense or is it the wrong tack?