]> git.proxmox.com Git - proxmox.git/log
proxmox.git
5 years agomacro: split enum handler into separate module
Wolfgang Bumiller [Fri, 9 Aug 2019 10:40:43 +0000 (12:40 +0200)]
macro: split enum handler into separate module

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: split struct handlers into separate submodules
Wolfgang Bumiller [Fri, 9 Aug 2019 10:36:12 +0000 (12:36 +0200)]
macro: split struct handlers into separate submodules

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: split function handler into separate file
Wolfgang Bumiller [Fri, 9 Aug 2019 07:18:02 +0000 (09:18 +0200)]
macro: split function handler into separate file

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoimport Cargo.lock
Wolfgang Bumiller [Fri, 9 Aug 2019 06:44:48 +0000 (08:44 +0200)]
import Cargo.lock

We use some crates from their git-master branch and they can
sometimes conflict, so this should pin working revisions of
all crates.

Furthermore, when we start packaging things we'll need to
keep the lock file around as a reference to know the exact
sources we built packages from.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: errors shouldn't discard the code
Wolfgang Bumiller [Thu, 8 Aug 2019 12:04:27 +0000 (14:04 +0200)]
macro: errors shouldn't discard the code

Otherwise we'll get even more errors.
Consider this example:

    #[api(...)]
    struct Foo { ... }
    impl MyTrait for Foo { ... }

If the #[api] macro fails and does not at least produce the
`struct Foo{}` along with its `compile_error!()` output,
then in addition to our macro errors, we'll see errors about
trying to implement `MyTrait` for an unknown thing called
`Foo`.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: implement #[derive(FromStr)] for newtypes
Wolfgang Bumiller [Thu, 8 Aug 2019 11:53:24 +0000 (13:53 +0200)]
macro: implement #[derive(FromStr)] for newtypes

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoformatting cleanup
Wolfgang Bumiller [Thu, 8 Aug 2019 11:13:35 +0000 (13:13 +0200)]
formatting cleanup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agocleanup
Wolfgang Bumiller [Thu, 8 Aug 2019 11:13:19 +0000 (13:13 +0200)]
cleanup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: derive ser/de for newtypes just like structs
Wolfgang Bumiller [Thu, 8 Aug 2019 09:29:12 +0000 (11:29 +0200)]
macro: derive ser/de for newtypes just like structs

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: make sure errors are separated
Wolfgang Bumiller [Thu, 8 Aug 2019 09:17:37 +0000 (11:17 +0200)]
macro: make sure errors are separated

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: factor out newtype handler
Wolfgang Bumiller [Thu, 8 Aug 2019 09:12:07 +0000 (11:12 +0200)]
macro: factor out newtype handler

Reuse verifier code of structs fields. Add handling of
'validate' methods for fields.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: more quote -> quote_spanned changes
Wolfgang Bumiller [Thu, 8 Aug 2019 09:09:58 +0000 (11:09 +0200)]
macro: more quote -> quote_spanned changes

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: remove unused add_verifiers
Wolfgang Bumiller [Thu, 8 Aug 2019 09:09:29 +0000 (11:09 +0200)]
macro: remove unused add_verifiers

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoformatting fixup
Wolfgang Bumiller [Mon, 5 Aug 2019 12:14:09 +0000 (14:14 +0200)]
formatting fixup

make fmt
(cargo fmt --all)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agowhitespace cleanup
Wolfgang Bumiller [Mon, 5 Aug 2019 12:13:37 +0000 (14:13 +0200)]
whitespace cleanup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agocleanup use statements
Wolfgang Bumiller [Mon, 5 Aug 2019 12:12:49 +0000 (14:12 +0200)]
cleanup use statements

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agocleanup Cargo.toml files
Wolfgang Bumiller [Mon, 5 Aug 2019 12:09:54 +0000 (14:09 +0200)]
cleanup Cargo.toml files

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agosys: rustfmt workaround
Wolfgang Bumiller [Mon, 5 Aug 2019 10:46:21 +0000 (12:46 +0200)]
sys: rustfmt workaround

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agotools: Cargo.toml: cleanup
Wolfgang Bumiller [Mon, 5 Aug 2019 10:36:35 +0000 (12:36 +0200)]
tools: Cargo.toml: cleanup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agorename tools::raw to tools::fd
Wolfgang Bumiller [Mon, 5 Aug 2019 10:36:24 +0000 (12:36 +0200)]
rename tools::raw to tools::fd

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoproxmox-tools/src/lib.rs: fix doc test
Dietmar Maurer [Mon, 5 Aug 2019 08:11:45 +0000 (10:11 +0200)]
proxmox-tools/src/lib.rs: fix doc test

5 years agoformatting fixup
Wolfgang Bumiller [Fri, 2 Aug 2019 09:26:40 +0000 (11:26 +0200)]
formatting fixup

add #[rustfmt::skip] to our macros...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoadd nodename helper (copied from proxmox-backup)
Dietmar Maurer [Sat, 3 Aug 2019 15:00:02 +0000 (17:00 +0200)]
add nodename helper (copied from proxmox-backup)

5 years agosrc/linux/procfs.rs: moved from proxmox-backup
Dietmar Maurer [Sat, 3 Aug 2019 14:19:11 +0000 (16:19 +0200)]
src/linux/procfs.rs: moved from proxmox-backup

5 years agonew helper create_dir_chown
Dietmar Maurer [Sat, 3 Aug 2019 10:21:20 +0000 (12:21 +0200)]
new helper create_dir_chown

moved from proxmox-backup.

5 years agosrc/fs.rs: new module for fs related helpers
Dietmar Maurer [Sat, 3 Aug 2019 09:49:14 +0000 (11:49 +0200)]
src/fs.rs: new module for fs related helpers

5 years agoadd src/linux/magic.rs - moved from proxmox-backup
Dietmar Maurer [Sat, 3 Aug 2019 07:19:32 +0000 (09:19 +0200)]
add src/linux/magic.rs - moved from proxmox-backup

5 years agoapi-test: import struct tests
Wolfgang Bumiller [Thu, 1 Aug 2019 12:40:12 +0000 (14:40 +0200)]
api-test: import struct tests

This is a bigger set of tests for the type-side (mostly for
`struct`s) of the #[api] macro, tasting serialization and
verifiers in various forms.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoapi: support HashSet<String> as api type
Wolfgang Bumiller [Thu, 1 Aug 2019 09:20:10 +0000 (11:20 +0200)]
api: support HashSet<String> as api type

This is just an array of strings in json, or a
semicolon-separated string on the command line.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: improve error output
Wolfgang Bumiller [Wed, 31 Jul 2019 13:42:05 +0000 (15:42 +0200)]
macro: improve error output

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: clear a warning
Wolfgang Bumiller [Wed, 31 Jul 2019 12:39:18 +0000 (14:39 +0200)]
macro: clear a warning

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: recurse into struct field verifiers
Wolfgang Bumiller [Wed, 31 Jul 2019 12:35:00 +0000 (14:35 +0200)]
macro: recurse into struct field verifiers

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: support 'pattern' verifier in structs
Wolfgang Bumiller [Wed, 31 Jul 2019 12:32:35 +0000 (14:32 +0200)]
macro: support 'pattern' verifier in structs

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agotools: add remaining common regexps
Wolfgang Bumiller [Wed, 31 Jul 2019 09:45:45 +0000 (11:45 +0200)]
tools: add remaining common regexps

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agotools: add common_regex with IP_REGEX for now
Wolfgang Bumiller [Wed, 31 Jul 2019 09:45:21 +0000 (11:45 +0200)]
tools: add common_regex with IP_REGEX for now

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoformatting fixup
Wolfgang Bumiller [Tue, 30 Jul 2019 13:20:55 +0000 (15:20 +0200)]
formatting fixup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: support serialize_with and deserialize_with
Wolfgang Bumiller [Tue, 30 Jul 2019 13:19:51 +0000 (15:19 +0200)]
macro: support serialize_with and deserialize_with

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: don't enforce the AsOptionStr type on formats
Wolfgang Bumiller [Tue, 30 Jul 2019 08:33:07 +0000 (10:33 +0200)]
macro: don't enforce the AsOptionStr type on formats

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoapi, macro: implement 'format' verifier for structs
Wolfgang Bumiller [Tue, 30 Jul 2019 08:06:32 +0000 (10:06 +0200)]
api, macro: implement 'format' verifier for structs

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoapi: macro: implement minimum/maximum_length checks
Wolfgang Bumiller [Mon, 29 Jul 2019 12:40:04 +0000 (14:40 +0200)]
api: macro: implement minimum/maximum_length checks

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoapi: verify: rename Verify to TestMinMax
Wolfgang Bumiller [Mon, 29 Jul 2019 12:30:32 +0000 (14:30 +0200)]
api: verify: rename Verify to TestMinMax

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoapi: add helper module for verifiers
Wolfgang Bumiller [Mon, 29 Jul 2019 12:16:04 +0000 (14:16 +0200)]
api: add helper module for verifiers

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agorefactor struct handling
Wolfgang Bumiller [Mon, 29 Jul 2019 10:00:51 +0000 (12:00 +0200)]
refactor struct handling

less spaghetti code accumulation, more purpose oriented
functions

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: disable derive_default for now
Wolfgang Bumiller [Fri, 19 Jul 2019 13:24:39 +0000 (15:24 +0200)]
macro: disable derive_default for now

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: fixup: don't create unwanted default impl snippets
Wolfgang Bumiller [Fri, 19 Jul 2019 13:20:45 +0000 (15:20 +0200)]
macro: fixup: don't create unwanted default impl snippets

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: partial support for automatic Default derivation
Wolfgang Bumiller [Fri, 19 Jul 2019 13:17:25 +0000 (15:17 +0200)]
macro: partial support for automatic Default derivation

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: support Option in deserialization
Wolfgang Bumiller [Fri, 19 Jul 2019 12:50:23 +0000 (14:50 +0200)]
macro: support Option in deserialization

When deserializing we currently expect all fields to be
available, but we actually want Option types to be truly
optional...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoformatting cleanup
Wolfgang Bumiller [Fri, 19 Jul 2019 12:30:48 +0000 (14:30 +0200)]
formatting cleanup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoimplement accessors for types with defaults
Wolfgang Bumiller [Fri, 19 Jul 2019 12:09:15 +0000 (14:09 +0200)]
implement accessors for types with defaults

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoapi: add a meta module to help with macro impls
Wolfgang Bumiller [Fri, 19 Jul 2019 12:08:55 +0000 (14:08 +0200)]
api: add a meta module to help with macro impls

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agodefault to not serializing None options
Wolfgang Bumiller [Fri, 19 Jul 2019 11:22:18 +0000 (13:22 +0200)]
default to not serializing None options

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agocleanup
Wolfgang Bumiller [Fri, 19 Jul 2019 09:07:10 +0000 (11:07 +0200)]
cleanup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: replace named struct handler
Wolfgang Bumiller [Fri, 19 Jul 2019 09:03:37 +0000 (11:03 +0200)]
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>
5 years agomacro: error handling
Wolfgang Bumiller [Fri, 19 Jul 2019 08:04:38 +0000 (10:04 +0200)]
macro: error handling

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: common defs: add default, and sort
Wolfgang Bumiller [Fri, 19 Jul 2019 08:01:59 +0000 (10:01 +0200)]
macro: common defs: add default, and sort

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: improved error output
Wolfgang Bumiller [Fri, 19 Jul 2019 07:58:07 +0000 (09:58 +0200)]
macro: improved error output

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: named struct: allow short form for fields
Wolfgang Bumiller [Thu, 18 Jul 2019 13:05:26 +0000 (15:05 +0200)]
macro: named struct: allow short form for fields

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: add spans to more errors
Wolfgang Bumiller [Thu, 18 Jul 2019 12:59:09 +0000 (14:59 +0200)]
macro: add spans to more errors

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: ability to rename enum variants via an attribute
Wolfgang Bumiller [Thu, 18 Jul 2019 12:52:25 +0000 (14:52 +0200)]
macro: ability to rename enum variants via an attribute

In PVE we have multiple different enum types: hyphenated,
all-caps, underscores.

By default our api-macro enums will convert CamelCase to
underscores, so we need a way to represent the rest:

enum AnEnum {
CaseOne, // becomes "case_one",
#[api(rename = "case-two")]
CaseTwo, // "case-two",
#[api(rename = "CASE_THREE")]
CaseThree,
}

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: cleanup error handling, remove error module
Wolfgang Bumiller [Thu, 18 Jul 2019 12:41:26 +0000 (14:41 +0200)]
macro: cleanup error handling, remove error module

syn::Error already covers this

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoformatting cleanup
Wolfgang Bumiller [Thu, 18 Jul 2019 11:58:26 +0000 (13:58 +0200)]
formatting cleanup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: more error handling improvements
Wolfgang Bumiller [Thu, 18 Jul 2019 11:57:51 +0000 (13:57 +0200)]
macro: more error handling improvements

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: add types.rs, preserve Span for Expressions
Wolfgang Bumiller [Thu, 18 Jul 2019 11:54:51 +0000 (13:54 +0200)]
macro: add types.rs, preserve Span for Expressions

Move the Name type into types.rs and make it hashable.
Expression::Object not contains an Object where the
hashmap's key is a Name and therefore preserves the Span of
all the keys for better error messages.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: add TypeInfo for enum types
Wolfgang Bumiller [Thu, 18 Jul 2019 09:26:57 +0000 (11:26 +0200)]
macro: add TypeInfo for enum types

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: more absolute paths
Wolfgang Bumiller [Thu, 18 Jul 2019 09:26:49 +0000 (11:26 +0200)]
macro: more absolute paths

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agocleanup/remove old code
Wolfgang Bumiller [Thu, 18 Jul 2019 09:15:21 +0000 (11:15 +0200)]
cleanup/remove old code

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: started basic enum support
Wolfgang Bumiller [Thu, 18 Jul 2019 09:14:58 +0000 (11:14 +0200)]
macro: started basic enum support

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoprepare to parse enums
Wolfgang Bumiller [Thu, 18 Jul 2019 08:51:16 +0000 (10:51 +0200)]
prepare to parse enums

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoapi-server, tools: formatting cleanup
Wolfgang Bumiller [Thu, 18 Jul 2019 08:47:56 +0000 (10:47 +0200)]
api-server, tools: formatting cleanup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: add spanned format_err equivalent
Wolfgang Bumiller [Thu, 18 Jul 2019 08:47:41 +0000 (10:47 +0200)]
macro: add spanned format_err equivalent

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomacro: helpers for error handling
Wolfgang Bumiller [Thu, 18 Jul 2019 08:28:24 +0000 (10:28 +0200)]
macro: helpers for error handling

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoexample for better error messages
Wolfgang Bumiller [Wed, 17 Jul 2019 14:49:19 +0000 (16:49 +0200)]
example for better error messages

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoapi: export derive_parse_cli_from_str
Wolfgang Bumiller [Wed, 17 Jul 2019 14:19:45 +0000 (16:19 +0200)]
api: export derive_parse_cli_from_str

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agotests: use an async block instead of an async closure
Wolfgang Bumiller [Wed, 17 Jul 2019 14:13:36 +0000 (16:13 +0200)]
tests: use an async block instead of an async closure

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoupdate api server to hyper git master
Wolfgang Bumiller [Wed, 17 Jul 2019 10:12:22 +0000 (12:12 +0200)]
update api server to hyper git master

This is now an example requiring no future-compat anymore.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agotools: actually add raw module
Wolfgang Bumiller [Wed, 17 Jul 2019 10:12:08 +0000 (12:12 +0200)]
tools: actually add raw module

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agotools: add raw::Fd
Wolfgang Bumiller [Tue, 2 Jul 2019 13:47:36 +0000 (15:47 +0200)]
tools: add raw::Fd

to replace proxmox_backup's tools::Fd

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agomake valgrind opt-in, not opt-out
Wolfgang Bumiller [Tue, 2 Jul 2019 13:23:30 +0000 (15:23 +0200)]
make valgrind opt-in, not opt-out

otherwise this crate cannot be compiled without nightly as
valgrind_request requires feature(asm)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agotools: move vec::ops::* to vec::ByteVecExt
Wolfgang Bumiller [Mon, 1 Jul 2019 09:00:29 +0000 (11:00 +0200)]
tools: move vec::ops::* to vec::ByteVecExt

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoremove deprecated tools::io::ops reexport
Wolfgang Bumiller [Mon, 1 Jul 2019 08:56:27 +0000 (10:56 +0200)]
remove deprecated tools::io::ops reexport

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agotools: add io::WriteExt
Wolfgang Bumiller [Mon, 1 Jul 2019 08:25:15 +0000 (10:25 +0200)]
tools: add io::WriteExt

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agotools: change tools::io::ops::*:
Wolfgang Bumiller [Mon, 1 Jul 2019 07:53:04 +0000 (09:53 +0200)]
tools: change tools::io::ops::*:

We'll stick to existing naming conventions and provide:
    tools::io::{ReadExt, WriteExt}

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoapi: split ApiHandler out of ApiMethodInfo
Wolfgang Bumiller [Sun, 23 Jun 2019 10:52:04 +0000 (12:52 +0200)]
api: split ApiHandler out of ApiMethodInfo

The method info part is not generic after all.
(Makes it easier to test different representations of
ApiHandler without having to adapt all the other methods as
well.)

Signed-off-by: Wolfgang Bumiller <wry.git@bumiller.com>
5 years agomacro: cleanup: rename parse_object2 to parse_object
Wolfgang Bumiller [Wed, 26 Jun 2019 11:48:31 +0000 (13:48 +0200)]
macro: cleanup: rename parse_object2 to parse_object

The old parse_object function is gone now.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoapi: WIP: don't depend on a specific Body type
Wolfgang Bumiller [Sun, 23 Jun 2019 09:41:27 +0000 (11:41 +0200)]
api: WIP: don't depend on a specific Body type

For a T which is not directly a Body or Response<Body> type
    #[api]
    fn foo() -> T;
should not require a specific Body type.

Signed-off-by: Wolfgang Bumiller <wry.git@bumiller.com>
5 years agoapi: replace handler() with call()
Wolfgang Bumiller [Sun, 23 Jun 2019 09:19:49 +0000 (11:19 +0200)]
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>
5 years agoapi-macro: remove old comment
Wolfgang Bumiller [Sun, 23 Jun 2019 09:10:32 +0000 (11:10 +0200)]
api-macro: remove old comment

Signed-off-by: Wolfgang Bumiller <wry.git@bumiller.com>
5 years agoapi: make method body an associated type
Wolfgang Bumiller [Wed, 19 Jun 2019 13:16:40 +0000 (15:16 +0200)]
api: make method body an associated type

This way we do not need to carry the body type into the CLI
router and can instead just require the body to be
Into<Bytes>.

This also makes more sense, because previously a method
could in theory implement multiple ApiMethodInfo types with
different bodies which seems pointless.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agotools: add doc tests for bin_to_hex, hex_to_bin
Wolfgang Bumiller [Wed, 19 Jun 2019 12:14:54 +0000 (14:14 +0200)]
tools: add doc tests for bin_to_hex, hex_to_bin

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoadd make apitest
Wolfgang Bumiller [Tue, 18 Jun 2019 15:52:29 +0000 (17:52 +0200)]
add make apitest

runs the api test server

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoadd helper Makefile
Wolfgang Bumiller [Tue, 18 Jun 2019 15:49:40 +0000 (17:49 +0200)]
add helper Makefile

make -> make check
make check -> cargo test
make fmt -> cargo fmt --all
make checkfmt -> cargo fmt --all -- --check
...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agotest update
Wolfgang Bumiller [Tue, 18 Jun 2019 11:14:32 +0000 (13:14 +0200)]
test update

use the 'newboth' command as well

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoapi: fix Option<> types, implement bools, add tests
Wolfgang Bumiller [Tue, 18 Jun 2019 10:45:19 +0000 (12:45 +0200)]
api: fix Option<> types, implement bools, add tests

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agotools: add doc-test for bytes_as_base64
Wolfgang Bumiller [Tue, 18 Jun 2019 10:12:59 +0000 (12:12 +0200)]
tools: add doc-test for bytes_as_base64

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agotools: make date_time_as_rfc3339 work for all TimeZones
Wolfgang Bumiller [Tue, 18 Jun 2019 10:10:45 +0000 (12:10 +0200)]
tools: make date_time_as_rfc3339 work for all TimeZones

and add a doc-test passing `cargo test`
(and formatting fixup)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoformatting fixup
Wolfgang Bumiller [Tue, 18 Jun 2019 08:17:34 +0000 (10:17 +0200)]
formatting fixup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agosrc/serde.rs: add serde helpers
Dietmar Maurer [Tue, 18 Jun 2019 08:22:11 +0000 (10:22 +0200)]
src/serde.rs: add serde helpers

5 years agoapi: set missing description of Option types
Wolfgang Bumiller [Mon, 17 Jun 2019 13:06:18 +0000 (15:06 +0200)]
api: set missing description of Option types

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agocli: fix options with arguments, add tests
Wolfgang Bumiller [Mon, 17 Jun 2019 13:01:46 +0000 (15:01 +0200)]
cli: fix options with arguments, add tests

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoformatting fixup
Wolfgang Bumiller [Mon, 17 Jun 2019 10:32:22 +0000 (12:32 +0200)]
formatting fixup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>