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

update to typed-builder 0.15 (closes #1455) #1496

Closed
wants to merge 2 commits into from
Closed

update to typed-builder 0.15 (closes #1455) #1496

wants to merge 2 commits into from

Conversation

gbj
Copy link
Collaborator

@gbj gbj commented Aug 4, 2023

closes #1455

@awesomelemonade
Copy link

@gbj
Copy link
Collaborator Author

gbj commented Aug 7, 2023

Okay, this appears to make it impossible for us to update to typed-builder 0.15 without asking users to add typed-builder as a dependency in their own apps, because typed-builder now uses an absolute dependency here in its output:

if field.builder_attr.setter.skip.is_some() {
    quote!(let #name = #default;)
} else {
    quote!(let #name = ::typed_builder::Optional::into_value(#name, || #default);)
}

I'm not aware of any way around this. Do you have any thoughts, @awesomelemonade?

@awesomelemonade
Copy link

Okay, this appears to make it impossible for us to update to typed-builder 0.15 without asking users to add typed-builder as a dependency in their own apps, because typed-builder now uses an absolute dependency here in its output:

if field.builder_attr.setter.skip.is_some() {
    quote!(let #name = #default;)
} else {
    quote!(let #name = ::typed_builder::Optional::into_value(#name, || #default);)
}

I'm not aware of any way around this. Do you have any thoughts, @awesomelemonade?

Doing some research. Likely an issue for typed-builder again. Here are some relevant links:
rust-lang/rust#54363
frozenlib/parse-display#28

@awesomelemonade
Copy link

Ok figured out a proof of concept patch:

For leptos expecting 0.14 typed builder, we can append this to Cargo.toml

[patch.crates-io]
typed-builder = { git = "https://github.com/awesomelemonade/rust-typed-builder", branch = "v14" }

https://github.com/awesomelemonade/rust-typed-builder has the patch that would work in this branch. See this commit and this comment

@gbj
Copy link
Collaborator Author

gbj commented Aug 24, 2023

Looks like this PR is the solution idanarye/rust-typed-builder#111

@idanarye
Copy link

@gbj - before I merge that PR I want to confirm that it works. @awesomelemonade - I understand you already have a version of leptos that points at your fork of Typed Builder with a reversion of the crate split. Can you change that to point at my PR branch instead and confirm that the macro works (once you pass the crate_module_path)?

@awesomelemonade
Copy link

awesomelemonade commented Aug 24, 2023

@gbj - before I merge that PR I want to confirm that it works. @awesomelemonade - I understand you already have a version of leptos that points at your fork of Typed Builder with a reversion of the crate split. Can you change that to point at my PR branch instead and confirm that the macro works (once you pass the crate_module_path)?

Unfortunately I don't have a fork of leptos ready to test this. I was changing the Cargo.toml to point to my version of typed-builder (mentioned here). I've been real busy with other stuff recently and haven't been working on the leptos project. @gbj do you have time to test this?

After changing the code on the leptos side, you should just be able to use the following in Cargo.toml

typed-builder = { git = "https://github.com/idanarye/rust-typed-builder", branch = "issue-109-setting-crate_module_path" }

You can then confirm you are using 0.15 by confirming that this code compiles (because 0.15 fixes a bug that would make this fail to compile):

#[component]
fn InfoGrid<const NUM_ROWS: usize, const NUM_COLS: usize>(
    cx: Scope,
    data: [[u32; NUM_ROWS]; NUM_COLS],
) -> impl IntoView {
    todo!()
}

@idanarye
Copy link

Okay, my solution seems to be working. I've released version 0.16 of Typed Builder.

@gbj
Copy link
Collaborator Author

gbj commented Aug 26, 2023

Restarted this one in #1590.

@gbj gbj closed this Aug 26, 2023
@gbj gbj deleted the 1455 branch August 26, 2023 11:34
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.

Components w/ const generics and other generics yields compilation error
3 participants