proxmox/proxmox-api-macro
Wolfgang Bumiller 691af5cade add the ParseCli trait
In order to get parameters from the command line into the
API we need to get them into a json value, so that we can
pass it down the handler which deserializes them into their
real type and runs verifications.
For this we need to define how the type is going to be
converted into a json Value. We cannot simply use
Deserialize as that would for instance require quotes
around strings. So instead, we have a ParseCli trait, which
is a nop (direct serde_json::Value::String()) for string
types, and uses .parse() (the std::str::FromStr trait) for
everything else.

Currently this uses a `default fn` as an example of the
specialization feature, but I'll probably remove this and
use yet another mass-impl macro since there isn't much
activity on that feature's issue tracker. (The issue itself
seems to be outdated ...

Signed-off-by: Wolfgang Bumiller <wry.git@bumiller.com>
2019-06-17 12:31:29 +02:00
..
src add the ParseCli trait 2019-06-17 12:31:29 +02:00
tests macro: implement minimum and maximum verification 2019-06-13 14:29:09 +02:00
Cargo.toml fix missing proxmox_api -> proxmox::api replacement 2019-06-12 09:48:30 +02:00