1097 Commits

Author SHA1 Message Date
Wolfgang Bumiller
7799deb095 api-macro: refactoring: split api macro function
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-26 14:18:27 +01:00
Wolfgang Bumiller
97c29f0db5 api-macro: move json part to util module
The json value type is more of an intermediate step between
the TokenStream and the Schema type and should stay somewhat
independent of it. We may want to reuse it for the router?

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-26 14:07:49 +01:00
Wolfgang Bumiller
c5f9227c23 api-macro: remove old unused files
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-26 14:04:44 +01:00
Wolfgang Bumiller
0a7cc08f3a api-macro: fix section iteration
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-26 13:39:56 +01:00
Wolfgang Bumiller
366b50dee7 api-macro: understand a 'Returns:' section in function doc comments
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-26 13:39:20 +01:00
Wolfgang Bumiller
b899c3e9ee api-macro: correctly concatenate doc macros
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-26 13:34:41 +01:00
Wolfgang Bumiller
7f7a9fe92f api-macro: make type optional in some cases
Objects and arrays are now optionally identified by their
'properties' or 'items' property if their 'type' is left
out.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-26 13:27:54 +01:00
Wolfgang Bumiller
5b41f68891 api-macro: trim doc-comment when used as description
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-26 12:17:40 +01:00
Wolfgang Bumiller
5a2fe67cd8 api-macro: rename elements to properties
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-26 12:16:05 +01:00
Wolfgang Bumiller
a646146f75 replace builder-pattern api macro parser with json
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-26 12:12:49 +01:00
Wolfgang Bumiller
ac45b7cea6 run 'cargo fmt -- --check' in check target
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-25 15:08:53 +01:00
Wolfgang Bumiller
9b07990086 formatting fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-25 15:07:18 +01:00
Dietmar Maurer
7e3b6944f6 proxmox_api: improve ApiStringFormat docs 2019-11-24 10:34:59 +01:00
Dietmar Maurer
e4d44ae7a3 proxmox-api: rename ApiStringFormat::Complex into ApiStringFormat::PropertyString 2019-11-24 09:51:45 +01:00
Dietmar Maurer
38abbed608 proxmox-api: improve schema docs 2019-11-23 17:00:36 +01:00
Dietmar Maurer
a3c62c420d proxmox-api: improve schema docs 2019-11-23 15:55:18 +01:00
Dietmar Maurer
6d31db9aca proxmox-api: further doc improvements 2019-11-23 14:13:52 +01:00
Dietmar Maurer
ed426cd99b proxmox-api: improve router docs 2019-11-23 14:08:44 +01:00
Dietmar Maurer
f02462039d proxmox-api - improve Router docs 2019-11-23 11:51:16 +01:00
Dietmar Maurer
c1ffee0901 proxmox-api: move impl ApiMethod to lib.rs 2019-11-23 10:58:32 +01:00
Dietmar Maurer
446ee31466 const_regex: fixup for previous commit 2019-11-23 10:48:36 +01:00
Dietmar Maurer
e89a52c30b proxmox-api: further cleanups
- improve docs
- move  ConstRegexPattern to const_regex.rs
2019-11-23 10:42:17 +01:00
Dietmar Maurer
fa83cbde13 proxmox-api/src/lib.rs: hide modules with inlined docs 2019-11-23 09:53:18 +01:00
Dietmar Maurer
edb41c1929 proxmox_api - ApiHandler: rename Async into AsyncHttp
And improve docs.
2019-11-23 08:54:07 +01:00
Wolfgang Bumiller
5721d21a5e import a first draft of api macros
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-22 15:23:24 +01:00
Dietmar Maurer
e06151b90e api: simplify ApiAsyncHandlerFn 2019-11-22 12:48:36 +01:00
Wolfgang Bumiller
f73ebb7209 api: add format module
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-22 09:28:22 +01:00
Wolfgang Bumiller
a6ce1e432b api: fully qualify types in exported macros
and move const_regex macro into a separate module

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 14:05:23 +01:00
Wolfgang Bumiller
c38d18484d api: move ApiMethod from router to top level
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 13:43:10 +01:00
Wolfgang Bumiller
c0266a17cd move HttpError to separate error module
the router doesn't actually use it

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 13:38:57 +01:00
Wolfgang Bumiller
2577effaf7 api: schema: avoid an extra temp string
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 13:32:42 +01:00
Wolfgang Bumiller
b489c2ceeb import the new api definitions
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 13:30:28 +01:00
Wolfgang Bumiller
068d56ed3d delete the old api macro stuff
to be replaced by a new set of macros for the current api
schema in proxmox-backup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 13:13:18 +01:00
Wolfgang Bumiller
7f4d223a4a rename sorted-data to proxmox-sortable_macro
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 13:10:37 +01:00
Wolfgang Bumiller
297aca53f7 proxmox: add sortable-macro feature
Use:
    # Cargo.toml:
    [dependencies]
    proxmox = { version = "0.1", features = [ "sortable-macro" ] }

    # file.rs
    use proxmox::{sortable, identity};
    #[sortable]
    const DATA: &[u8; 4] = sorted!([3, 4, 1, 2]);

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 11:04:13 +01:00
Wolfgang Bumiller
ceb3ff5544 import sorted-data proc macro
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 11:04:13 +01:00
Wolfgang Bumiller
729fed5eac tools: add identity macro
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 10:24:27 +01:00
Wolfgang Bumiller
3cc4bcd78e tools: uuid: don't use uuid_parse
The manpage states that it requires a terminating null byte.
We don't have that. Also, the uuid crate also accepted
non-hyphenated hex strings, so we do that as well.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-14 10:13:08 +01:00
Wolfgang Bumiller
6cf330c9d2 add tools::parse submodule, move hex_nibble to it
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-14 09:59:04 +01:00
Wolfgang Bumiller
85a9752ea2 tools: uuid: fix doc comments
(at least use the correct format)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-14 09:48:08 +01:00
Wolfgang Bumiller
b53b621cd8 add Uuid replacement
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-13 14:49:11 +01:00
Wolfgang Bumiller
db83a675f0 sys: get rid of Regex dependency
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-13 14:49:11 +01:00
Wolfgang Bumiller
b294fb1314 sys: add read_proc_pid_stat test
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-13 14:49:11 +01:00
Dietmar Maurer
1ae66863d1 update toolchain to stable 2019-11-08 11:51:21 +01:00
Dietmar Maurer
3172a01ce1 set toolchain to beta 2019-10-12 14:09:43 +02:00
Wolfgang Bumiller
ddea357de2 work around a compiler bug
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-10-04 14:12:21 +02:00
Wolfgang Bumiller
589cb7e296 macro: enforce Send
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-10-04 14:11:33 +02:00
Wolfgang Bumiller
df55ab2dda api-macro: update to 1.0 of syn/quote/proc_macro2
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-10-04 13:42:03 +02:00
Wolfgang Bumiller
e0b50d07bf cleanup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-28 10:36:43 +02:00
Wolfgang Bumiller
617e25abba api: make ApiMethodInfo already require Send + Sync
ApiMethodInfo provides static information about a type

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-28 10:30:33 +02:00