1 unstable release

new 0.0.1-alpha1 Nov 17, 2024

#98 in #job

Download history 99/week @ 2024-11-15

99 downloads per month
Used in jobby

MIT/Apache

14KB
287 lines

jobby_derive

This is a helper crate for working with jobby. Look at the documentation for jobby for usage instructions.


lib.rs:

This crate provides a procedural macro for deriving job types in jobby.

The JobType macro allows you to define enums that represent different job types, along with associated metadata such as client IDs and names. It also supports attributes for marking variants as submittable via an admin UI

Usage

To use this macro, annotate your enum with #[derive(JobType)] and provide the necessary attributes. For example:

#[derive(JobType)]
#[job_type(u8, 1, "example", "example_module")]
enum ExampleJob {
    #[job_type(submittable)]
    JobA = 1,
    JobB = 2,
}

This will generate implementations for converting the enum to and from its underlying representation, as well as metadata retrieval functions.

Dependencies

~1.5MB
~37K SLoC