proxmox/proxmox-api-macro
Wolfgang Bumiller 4f042f8133 api-macro: support external types
See the test example:

assuming a `pub struct Foo` which implements `Serialize` and
`Deserialize`, we also expect it to provide a
`pub const Foo::API_SCHEMA: &Schema` like so:

    #[derive(Deserialize, Serialize)]
    pub struct StrongString(String);
    impl StrongString {
        pub const API_SCHEMA: &'static Schema =
            &StringSchema::new("Some generic string")
                .format(&ApiStringFormat::Enum(&["a", "b"]))
                .schema();
    }

Then we can use:

    #[api(
        input: {
            properties: {
                arg: { type: StrongString },
            }
        },
        ...
    )]
    fn my_api_func(arg: StrongString) -> Result<...> {
        ...
    }

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-28 10:42:35 +01:00
..
src api-macro: support external types 2019-11-28 10:42:35 +01:00
tests api-macro: support external types 2019-11-28 10:42:35 +01:00
Cargo.toml api-macro: update to 1.0 of syn/quote/proc_macro2 2019-10-04 13:42:03 +02:00