#macro-derive #serialization #structs #defines #requests #authoring #attributes

macro pandora-api-derive

Defines a derive macro and some attributes to simplify authoring structs that can be serialized as Pandora API requests

2 releases

0.1.2 Aug 23, 2023
0.1.0 Feb 28, 2020

#14 in #authoring

33 downloads per month
Used in pandora-api

MIT license

11KB
169 lines

Derive macros for automatically adding an implementation of pandora_api::Pandora<Json|Rest>ApiRequest to a struct.

The name of the Pandora API method that will be called defaults to the result of converting the struct name to lower camel case (GetFoo -> getFoo). This may be overridden using the #[pandora_request(method_name = getFOOBar) struct attribute.

The default error type is Error. If a different type name is required, this may be overridden using the #[pandora_request(error_type = FooError)] struct attribute.

The default return type of the request is Response. This may be overridden using the #[pandora_request(response_type = FooResponse)] struct attribute.

The default for a request is to send it unencrypted. If the request must be encrypted, this may be overridden using the #[pandora_request(encrypted = true)] struct attribute.

Dependencies

~0.7–1.2MB
~27K SLoC