Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(blueprint-metadata): support custom types #624

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Serial-ATA
Copy link
Contributor

@Serial-ATA Serial-ATA commented Jan 29, 2025

Overview

This makes it possible to use custom structs and enums as job parameters, and have them be encoded in the blueprint.json.

pub struct SomeStruct {
    pub num: u64,
}

#[blueprint_sdk::job(
    id = 0,
    params(x),
    /* ... */
)]
pub fn xsquare(x: SomeStruct, _context: MyContext) -> Result<u64, Infallible> {
    Ok(x.num.saturating_pow(2))
}

Status

This currently doesn't support structs containing external types.
This currently doesn't support:

  • generic arguments

What does work:

  • Enums
  • Structs with primitives or local types
  • External types

@Serial-ATA Serial-ATA added feature ➕ Tasks that are functional additions or enhancements DO NOT MERGE Please do not merge this PR yet, even if it is ready labels Jan 29, 2025
@Serial-ATA Serial-ATA force-pushed the serial/encode-custom-types branch from 1b5d73d to aec01bd Compare January 29, 2025 22:12
@Serial-ATA Serial-ATA linked an issue Jan 29, 2025 that may be closed by this pull request
@Serial-ATA Serial-ATA force-pushed the serial/encode-custom-types branch from 036d579 to f8655fb Compare January 30, 2025 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DO NOT MERGE Please do not merge this PR yet, even if it is ready feature ➕ Tasks that are functional additions or enhancements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TASK] Support custom types as job parameters
1 participant