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

A little experiment with macros instead of build scripts. #386

Closed
wants to merge 1 commit into from

Commits on Feb 18, 2021

  1. A little experiment with macros instead of build scripts.

    This commit is basically me messing around with procedural macros,
    to try them out as a potential future iteration of the UniFFI
    developer experience.
    
    As a crate author, I think it would be amazing not to have to
    worry about .udl files and build scripts and what-not, but
    instead be able to declare my API with a macro and have Rust
    just take care of the details. This commit is a tiny experiment
    in that direction, based on existing features of UniFFI.
    
    The idea is that I can wrap my Rust code in a little macro
    like this:
    
    ```
    [uniffi_macros::declare_interface]
    pub mod my_component {
      ...my rust code goes here...
    }
    ```
    
    And I can provide a corresponding `my_component.udl` file that
    declares the interface, and all the Rust scaffolding code just
    gets taken care of automagically.
    
    I still have to provide a `.udl` file, but I hope you can imagine
    one day the possibility of generating the interface definition
    directly from the Rust code that is decorated by the macro.
    Not any time soon! But one day...
    rfk committed Feb 18, 2021
    Configuration menu
    Copy the full SHA
    ef40e52 View commit details
    Browse the repository at this point in the history