Documentation error in Button::selectable()
- Dominant language
- Rust
- Stars
- 30.6k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 72
Description
This is a simple error in the documentation for [`Button::selectable()`](https://docs.rs/egui/latest/egui/widgets/struct.Button.html#method.selectable).
The documentation states that the code is equivalent to:
```rust
let selected = true;
ui.add(Button::new("toggle me").selected(selected).frame_when_inactive(!selected).frame(true));
```
However, the source code itself refutes this:
```rust
pub fn selectable(selected: bool, atoms: impl IntoAtoms<'a>) -> Self {
Self::new(atoms)
.selected(selected)
.frame_when_inactive(selected) // <- not negated!
.frame(true)
}
```
---
It's a super minor thing, but it just really surprised me when I first tried writing out the equivalent code in full, and the selectable buttons looked unexpectedly wrong.
Contributor guide
Research direction
Start with the Button::selectable() documentation at the linked docs.rs method and compare its equivalent code with the source implementation shown in the issue. Update the documented expression so it matches the implementation, then verify that the generated API documentation shows the corrected example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100