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

[Possible bug] Builder example isn't working #747

Open
ithinkicancode opened this issue Aug 15, 2023 · 3 comments
Open

[Possible bug] Builder example isn't working #747

ithinkicancode opened this issue Aug 15, 2023 · 3 comments
Labels

Comments

@ithinkicancode
Copy link

Describe the bug
The "builder" example in the examples dir isn't working - the program panics.

To Reproduce
It seems the builder feature is not released :) but I was trying that out. I set the version to this git repo in toml and added "builder" feature. Then I copied builder.rs and all the associated yaml files and then ran the program. The program panicked with the following error:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: RecipeFailed("Dialog", ResolveFailed { var_failure: InvalidConfig { message: "Expected variable as key", config: Object {"LinearLayout": Object {"children": Array [Object {"TextView": String("Fancy prompt")}, String("DummyView"), Object {"Titled": Object {"child": Object {"LabeledField": Object {"label": String("Please write:"), "name": String("edit"), "on_edit": String("$on_edit")}}, "title": String("Edit area")}}, Object {"Button": Object {"callback": String("$randomize"), "label": String("Randomize")}}, Object {"VSpace": Number(2)}, Object {"TextView": Object {"with": Array [Object {"name": String("status")}]}}], "with": Array [Object {"padding": Number(1)}, String("full_width"), Object {"fixed_height": Number(11)}]}} }, config_failure: RecipeFailed("LinearLayout", ResolveFailed { var_failure: InvalidConfig { message: "Expected variable as key", config: Object {"Titled": Object {"child": Object {"LabeledField": Object {"label": String("Please write:"), "name": String("edit"), "on_edit": String("$on_edit")}}, "title": String("Edit area")}} }, config_failure: RecipeNotFound("Titled") }) })', app/src/main.rs:74:32
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I understand if this feature is not ready, as it's not documented anywhere and the builder feature is not published (hence pointing to github in toml). :)

Expected behavior
I was hoping the example will work. I like the idea of composing UI in a declarative way.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment

  • latest version of MacOS
  • Backend used: ncurses
  • Current locale (run locale in a terminal)
  • Cursive version (from crates.io, from git, ...)

Additional context
Add any other context about the problem here.

@gyscos
Copy link
Owner

gyscos commented Aug 15, 2023

Hi, and thanks for the report!

The example should have been working (it was working the last time I tried).

It's possible you'd need to update the dependencies (the inventory crate in particular may be susceptible to breaking with new rust versions).

Will investigate when I get a chance.

@gyscos
Copy link
Owner

gyscos commented Aug 16, 2023

I can successfully run cargo run --example builder --features builder from this repo, does that not work for you?

Edit: indeed, running this from a separate crate doesn't seem to work. :(

@gyscos
Copy link
Owner

gyscos commented Sep 10, 2023

I think I found the issue (the builder macro had poor hygiene).

Can you try the latest commit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants