Skip to content

fix: don't require downstream bon dependency for components#222

Open
dvaergiller wants to merge 1 commit into
vidhanio:mainfrom
dvaergiller:dont-require-macro-users-to-have-bon-dep
Open

fix: don't require downstream bon dependency for components#222
dvaergiller wants to merge 1 commit into
vidhanio:mainfrom
dvaergiller:dont-require-macro-users-to-have-bon-dep

Conversation

@dvaergiller

Copy link
Copy Markdown
Contributor

Make the default builder for the #[renderable]/#[component] macro set the #[builder(crate = ::hypertext::bon)] parameter so that projects using the macros do not have to add bon to its own dependencies.

Without the crate parameter, the macro will expand to code that directly refereces bon. If the user of the macro does not have bon as a direct dependency it will generate the following error:

41 | #[renderable]
   | ^^^^^^^^^^^^^ could not find `bon` in the list of imported crates

This adds the crate parameter when not setting the builder directly. The DefaultBuilder works without it. But if one was to explicitly set #[renderable(builder = hypertext::Builder)] then one can either keep bon as a direct dependency or set the crate parameter manually. That should normally not be necessary since hypertext::Builder is the default builder.

Make the default builder for the `#[renderable]`/`#[component]` macro set the
`#[builder(crate = ::hypertext::bon)]` parameter so that projects using the
macros do not have to add bon to its own dependencies.

Without the `crate` parameter, the macro will expand to code that directly
refereces bon. If the user of the macro does not have bon as a direct dependency
it will generate the following error:

```
41 | #[renderable]
   | ^^^^^^^^^^^^^ could not find `bon` in the list of imported crates
```

This adds the `crate` parameter when not setting the builder directly. The
DefaultBuilder works without it. But if one was to explicitly set
`#[renderable(builder = hypertext::Builder)]` then one can either keep bon as a
direct dependency or set the `crate` parameter manually. That should normally
not be necessary since `hypertext::Builder` is the default builder.
@dvaergiller

Copy link
Copy Markdown
Contributor Author

It seems that Miri has stopped working on latest nightly?

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.

1 participant