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: language agnostic rust codegen #44

Closed
wants to merge 26 commits into from

Conversation

eliassjogreen
Copy link

@eliassjogreen eliassjogreen commented Jan 12, 2022

⚠️ WIP! ⚠️

This PR addresses #43, #4, #23 by implementing a new codegen in rust which in turn will be used by the macro and in the future extensions to deno bindgen which could enable for example c header support.

Todo:

  • Make the macro use the codegen crate
  • Update the CLI (it will have to be converted to rust to use the new codegen)
  • Library loader
    • Deno
    • Plug
  • Function generation
  • Into
    • Primitives
    • Pointers
    • Buffers
    • CString
    • Type aliases
    • Structs
    • Tuples
    • Enums
    • Arrays
  • From
    • Primitives
    • Pointers
    • Buffers
    • CString
    • Type aliases
    • Structs
    • Tuples
    • Enums
    • Arrays
  • JSON/serde fallback?
  • Packed structs?
  • Automatic minification and or formatting?
  • Flexible array members?

Previous works, references and resources:

@eliassjogreen eliassjogreen changed the title feat: loaders and function codegen feat: language agnostic rust codegen Jan 12, 2022
@littledivy
Copy link
Member

@eliassjogreen maybe the new CLI should be a custom cargo subcommand? https://github.com/rust-lang/cargo/wiki/Third-party-cargo-subcommands
I want to avoid distributing native binaries.

@eliassjogreen
Copy link
Author

@littledivy Yep I agree, that sounds like a wise choice

test.ts Outdated
Comment on lines 110 to 118
(__source instanceof ArrayBuffer
? __source
: __source instanceof Uint8Array
? __source.buffer
: __source instanceof Deno.UnsafePointer
? new Deno.UnsafePointerView(__source).getArrayBuffer(24)
: __source instanceof Deno.UnsafePointerView
? __source.getArrayBuffer(24)
: undefined)!;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be a helper function.

@littledivy littledivy marked this pull request as ready for review February 2, 2022 16:34
@littledivy littledivy marked this pull request as draft February 2, 2022 16:34
@littledivy
Copy link
Member

Closing because stale and merge conflicts.

@littledivy littledivy closed this Jan 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants