linebender / linebender/druid

expected tuple struct or tuple variant, found struct variant `KbKey::Character`

Open
#2,403 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
9.7k
Forks
565
PR merge metrics
No merged PRs in 30d

Description

When I was using druid version 0.7.0, the code worked fine.
```
[dependencies]
druid = "0.7.0"
reqwest = { version = "0.11", features = ["blocking"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
```
But when I modify my 0.8.3, I get an error that has nothing to do with my code, as follows
image

I tried the following operations, and it still didn’t solve the problem after re-running it.
```
# problem not solved
cargo clean

# problem not solved
rm -rf ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/druid-shell-0.8.3
```

Thanks ~

run command
```
cargo run --bin radio
```

the code
```
use druid::widget::{Flex, Label, RadioGroup};
use druid::{AppLauncher, Data, Lens, Widget, WidgetExt, WindowDesc};

#[derive(Clone, Data, Lens)]
struct AppData {
choice: String,
}

fn build_ui() -> impl Widget {
let choices = vec![
("Option 1".to_string(), "Value 1".to_string()),
("Option 2".to_string(), "Value 2".to_string()),
("Option 3".to_string(), "Value 3".to_string()),
];
let radio = RadioGroup::new(choices).lens(AppData::choice);

let label = Label::new(|data: &AppData, _env: &druid::Env| {
format!("You selected: {}", data.choice)
});

Flex::column()
.with_child(radio)
.with_child(label)
}

fn main() {
let main_window = WindowDesc::new(build_ui)
.title("RadioGroup Example")
.window_size((300.0, 200.0));

let data = AppData { choice: "Value 1".to_string() };

AppLauncher::with_window(main_window)
.use_simple_logger()
.launch(data)
.expect("Failed to launch application");
}

```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the shown RadioGroup example using druid 0.8.3 and `cargo run --bin radio`, then compare the result with druid 0.7.0. Start from the compiler diagnostic mentioning `druid-shell` and `KbKey::Character`; done means identifying whether the 0.8.3 API or dependency change causes the example to fail and documenting the compatible usage or regression.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.