gnosis / dex-services

Off-chain services for the Gnosis Protocol v1.
33 stars 9 forks source link

Implement `arg_enum` macro #1413

Closed nlordell closed 4 years ago

nlordell commented 4 years ago

This PR adds an arg_enum style macro for so we don't have to manually implement FromStr and variants for argument enums. This is done since it is a fairly simple macro and so we don't have to pull in clap into services-core.

Test Plan

Check that the new arguments parse correctly:

$ cargo run -p driver -- --solver-type BestRingSolver --solver-internal-optimizer Gurobi --scheduler Evm
    Finished dev [unoptimized + debuginfo] target(s) in 0.13s
     Running `target/debug/driver --solver-type BestRingSolver --solver-internal-optimizer Gurobi --scheduler Evm`
2020-09-09T04:45:26.574Z INFO [driver] Starting driver with runtime options: Options {
    ...
    solver_type: BestRingSolver,
    solver_internal_optimizer: Gurobi,
    ...
    scheduler: Evm,
    ...
}