Commit Graph

12 Commits

Author SHA1 Message Date
Wolfgang Bumiller
ec1ad87193 macro: replace named struct handler
We now derive Serialize and Deserialize automatically.
This way we'll be able to add verifiers right into the
structs, support our 'rename' functionality, and our
'default' handling etc. which needs to be compatible with
what we have in perl.
Ideally this will also give us the option to mark structs as
being perl-compatible "property strings"
(PVE::JSONSchema::parse_property_string()) and automatically
derive FromStr for structs on demand.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-19 11:04:55 +02:00
Wolfgang Bumiller
da40267188 api-server, tools: formatting cleanup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-18 10:47:56 +02:00
Wolfgang Bumiller
bfbba4e605 tests: use an async block instead of an async closure
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-17 16:13:36 +02:00
Wolfgang Bumiller
c8e11115d2 api: replace handler() with call()
An `fn` type can be more annoying to produce in some generic
cases, and we haven't really needed it yet.

Signed-off-by: Wolfgang Bumiller <wry.git@bumiller.com>
2019-06-23 11:19:49 +02:00
Wolfgang Bumiller
c48e17fe26 macro: add cli property and remove specialization
Drop #!feature(specialization) in favor of having a `cli`
property for types to decide whether they are CLI
compatible.

The unconstrained_type! macro now has both ParseCli and
ParseCliFromStr in view, and requires one of the two to be
implemented for a type. This means that if a type implements
FromStr, it should "just work".

For types created without the help of the #[api] macro,
there's a shortcut to exclude a type from the CLI via
the no_cli_type!{typename} macro.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-06-17 12:31:29 +02:00
Wolfgang Bumiller
41884a622e macro: check function parameters
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-06-12 16:33:12 +02:00
Wolfgang Bumiller
7db28deaff macro: body type support for router and api macros
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-06-12 09:48:30 +02:00
Wolfgang Bumiller
b82b14d947 macro: add wildcard matching to router macro
router!{
    /path/{parameter}*: {
        methods...
    }
}

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-06-12 09:48:30 +02:00
Wolfgang Bumiller
2b577c9c17 cleanup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-06-12 09:48:30 +02:00
Wolfgang Bumiller
7155689724 fix missing proxmox_api -> proxmox::api replacement
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-06-12 09:48:30 +02:00
Wolfgang Bumiller
3dd6cd3fe0 formatting fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-06-07 12:03:17 +02:00
Wolfgang Bumiller
b5c05fc85c import proxmox-api-macro crate
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-06-06 15:25:47 +02:00