Crates.io | npsd-schema |
lib.rs | npsd-schema |
version | 0.2.0 |
source | src |
created_at | 2024-06-29 15:33:27.975715 |
updated_at | 2024-07-19 05:56:13.85865 |
description | Implementation of #[derive(Schema, Bitmap, AsyncSchema, AsyncBitmap, Info)] |
homepage | |
repository | https://github.com/vmolsa/npsd |
max_upload_size | |
id | 1287433 |
size | 46,422 |
npsd
Derive MacrosThis repository provides a set of custom derive macros to simplify the implementation of traits required by the npsd
framework. These macros automate the generation of boilerplate code for various payload processing tasks, including serialization, deserialization, and payload conversion.
#[derive(Info)]
Generates an implementation of the PayloadInfo
trait, which provides metadata about the payload type.
#[derive(Schema)]
Generates implementations for payload processing traits such as IntoPayload
, FromPayload
, and Payload
for public use.
#[derive(Bitmap)]
Generates implementations for payload processing traits for bitmap structures with up to 8 fields.
#[derive(AsyncSchema)]
Generates asynchronous implementations for payload processing traits such as AsyncIntoPayload
, AsyncFromPayload
, and AsyncPayload
for public use.
#[derive(AsyncBitmap)]
Generates asynchronous implementations for payload processing traits for bitmap structures with up to 8 fields.
Here's a simple example demonstrating how to use the Schema
derive macro:
use npsd::Schema;
#[derive(Schema)]
struct MyPayload {
id: u32,
name: String,
}
This will automatically generate the necessary implementations for the IntoPayload
, FromPayload
, and Payload
traits for the MyPayload
struct.
For more detailed examples and usage, please refer to the documentation for each macro.
Contributions are welcome! Please feel free to submit a pull request or open an issue if you encounter any problems or have suggestions for improvements.
This project is licensed under the Apache 2.0 License.