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

Improve docs re: proc macros #1848

Merged
merged 2 commits into from
Nov 15, 2023
Merged

Conversation

ianthetechie
Copy link
Contributor

Closes #1816.

@ianthetechie ianthetechie requested a review from a team as a code owner November 14, 2023 19:18
@ianthetechie ianthetechie requested review from skhamis and removed request for a team November 14, 2023 19:18
Copy link
Member

@mhammond mhammond left a comment

Choose a reason for hiding this comment

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

Fantastic, thanks, just a couple of tweaks which I think are worthwhile.

All you need to do is add this to the top of `lib.rs`:

```rust
uniffi::setup_scaffolding!();
Copy link
Member

Choose a reason for hiding this comment

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

please add something like: The setup_scaffolding function takes one optional parameter, the ["namespace"](../udl/namespace,md] used by the component. If not specified, the name of the crate will be used as the namespace.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call; that's super helpful.


Use `generate --library` to generate foreign bindings by using a cdylib file built for your library.
This flag was added in UniFFI 0.24 and can be more convenient than specifying the UDL file -- especially when multiple UniFFI-ed crates are built together in one library.
The plan is to make library mode the default in a future UniFFI version.
The plan is to make library mode the default in a future UniFFI version, and it is highly recommended to specify the flag for now.
Copy link
Member

Choose a reason for hiding this comment

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

maybe add here "because some features simply don't work otherwise"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Member

@mhammond mhammond left a comment

Choose a reason for hiding this comment

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

Thank you!

@mhammond mhammond merged commit ed9362a into mozilla:main Nov 15, 2023
@ianthetechie ianthetechie deleted the proc-macros-docs branch November 15, 2023 14:38
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.

Improve docs around building / scaffolding when using proc macros
2 participants