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

Add support for generating structs in Rust with code generation #66

Closed
4 tasks done
desaikd opened this issue Nov 17, 2023 · 2 comments
Closed
4 tasks done

Add support for generating structs in Rust with code generation #66

desaikd opened this issue Nov 17, 2023 · 2 comments
Labels
code generation Improvements for code generation subcommand `generate`

Comments

@desaikd
Copy link
Contributor

desaikd commented Nov 17, 2023

Add support to generate struct based on Ion Schema. This will include supporting conversion of various struct related constraints in ISL.

Following ISL constraints will be supported with struct generation:

  • element
  • fields
  • type

Action Items for this implementation:

  • Define an initial workflow for code generation
  • Define templates for struct in Rust
  • Define constraint mapping for element, fields and type constraints in ISL to struct in Rust
  • Implement code generation for read and write API for struct in Rust
@desaikd desaikd added the code generation Improvements for code generation subcommand `generate` label Nov 17, 2023
@desaikd
Copy link
Contributor Author

desaikd commented Nov 17, 2023

Mappings for ISL constraints to Rust struct:

element -> SequenceStruct(creates a struct with single field that stores the sequence as a Vec)
e.g.

struct Foo { value: Vec<String> }

fields -> Struct (creates a struct with given field name and value/data type pairs)
e.g.

struct Foo { name: String, id: i64 }

type -> ValueStruct (creates a struct with single field that has the data type provided with type constraint)
e.g.

struct Foo { value: String }

@desaikd desaikd moved this from In Progress to Done in Code generation using Ion Schema Feb 22, 2024
@desaikd
Copy link
Contributor Author

desaikd commented Apr 9, 2024

Completed with #61 and #81

@desaikd desaikd closed this as completed Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code generation Improvements for code generation subcommand `generate`
Projects
Development

No branches or pull requests

1 participant