-
Notifications
You must be signed in to change notification settings - Fork 0
feat(gui): Migrate from iced 0.13.1 to iced 0.14.0 #65
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
Conversation
Complete migration of rustirc-gui crate to iced 0.14.0, resolving 82+ breaking API changes across 18 files. Breaking API changes fixed: - Space widget: with_width/with_height -> Space::new().width/height() - Application API: Now uses boot function pattern with .title() method - Horizontal/vertical space helpers removed, use Space::new() - Rule widget: horizontal_rule -> rule::horizontal - Checkbox API: checkbox(label, value) -> checkbox(value).label(label) - Scrollable IDs: scrollable::Id -> iced::widget::Id - Scrollable operations: scrollable::snap_to -> operation::snap_to - text_input::Status::Focused is now a struct variant with is_hovered - Style structs require new snap: bool field (button, container) - Pixels type bounds changed from u16 to f32 Quality assurance: - Zero compilation errors - Zero clippy warnings - All 131 tests passing Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found. |
Summary of ChangesHello @doublegate, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request performs a significant upgrade of the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR successfully migrates the RustIRC GUI from iced framework version 0.13.1 to 0.14.0, addressing 82+ breaking API changes. The migration is comprehensive and mechanical, updating widget APIs, application bootstrapping, style structures, and type signatures to align with the new framework version.
Changes:
- Updated iced dependency from 0.13.1 to 0.14.0 in Cargo.toml with corresponding dependency tree changes
- Migrated all Space widget usages from deprecated
Space::with_width/with_heightto builder patternSpace::new().width/height() - Updated application initialization from
iced::application(title, update, view)toiced::application(boot_fn, update, view).title() - Converted checkbox API from
checkbox(label, value)tocheckbox(value).label(label)builder pattern - Migrated scrollable IDs and operations to new module structure (
scrollable::Id→iced::widget::Id,scrollable::snap_to→operation::snap_to) - Updated
text_input::Status::Focusedfrom unit variant to struct variant withis_hoveredfield - Added required
snap: boolfield to Style structs and changed Pixels type bounds fromu16tof32 - Replaced
horizontal_rule(height)withrule::horizontal(height)
Reviewed changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Cargo.toml | Bumped iced version to 0.14.0 with updated comment |
| Cargo.lock | Extensive dependency tree updates for iced 0.14.0 ecosystem |
| CHANGELOG.md | Comprehensive documentation of migration changes and file modifications |
| crates/rustirc-gui/src/app.rs | Application API migration, rule widget updates, snap field addition, version comments |
| crates/rustirc-gui/src/dialogs.rs | Space widget API, checkbox builder pattern, max_width type change (u16→f32) |
| crates/rustirc-gui/src/material_demo.rs | Application boot function with default state initializer |
| crates/rustirc-gui/src/widgets/message_view.rs | Scrollable ID/operations migration, Space widget updates |
| crates/rustirc-gui/src/widgets/user_list.rs | Space widget API migrations (4 instances) |
| crates/rustirc-gui/src/widgets/tab_bar.rs | Space widget API migrations (7 instances) |
| crates/rustirc-gui/src/widgets/status_bar.rs | Space widget API migrations (8 instances) |
| crates/rustirc-gui/src/widgets/server_tree.rs | Space widget API migrations with multi-line conversions |
| crates/rustirc-gui/src/widgets/input_area.rs | Space widget API migrations (3 instances) |
| crates/rustirc-gui/src/components/atoms/button.rs | Added snap field to button::Style structs |
| crates/rustirc-gui/src/components/atoms/input.rs | Updated text_input::Status::Focused pattern matching |
| crates/rustirc-gui/src/components/molecules/message_bubble.rs | Added snap field to container::Style |
| crates/rustirc-gui/src/components/molecules/search_bar.rs | Updated text_input::Status::Focused pattern matching |
| crates/rustirc-gui/src/components/organisms/responsive_layout.rs | Space widget API and Pixels type changes (u16→f32) |
| crates/rustirc-gui/src/components/organisms/rich_text_editor.rs | Updated text_input::Status::Focused patterns (3 instances) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request is a significant and well-executed migration of the iced GUI framework from version 0.13.1 to 0.14.0. The changes are extensive, touching many files to adapt to the new APIs, and you have done a thorough job. My review includes a few suggestions to improve code maintainability by replacing magic numbers with named constants, which will make the layout logic clearer. I also noted a minor discrepancy in the changelog's file count. Overall, this is an excellent update that brings the project's GUI framework up to date.
| - **Style Structs**: Added required `snap: bool` field to `button::Style` and `container::Style` | ||
| - **Pixels Type**: Updated return types from `u16` to `f32` for Pixels trait bounds | ||
|
|
||
| #### Files Modified (19 total) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| fn adaptive_spacing(&self) -> f32 { | ||
| if self.adaptive_spacing { | ||
| match self.current_breakpoint { | ||
| Breakpoint::Compact => 8, | ||
| Breakpoint::Medium => 12, | ||
| _ => 16, | ||
| Breakpoint::Compact => 8.0, | ||
| Breakpoint::Medium => 12.0, | ||
| _ => 16.0, | ||
| } | ||
| } else { | ||
| 16 | ||
| 16.0 | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To improve readability and maintainability, consider extracting the magic numbers for spacing into named constants. This makes the code easier to understand and modify. For broader use, these constants could be defined at the module or impl level.
The same principle applies to the adaptive_padding function.
fn adaptive_spacing(&self) -> f32 {
const COMPACT_SPACING: f32 = 8.0;
const MEDIUM_SPACING: f32 = 12.0;
const DEFAULT_SPACING: f32 = 16.0;
if self.adaptive_spacing {
match self.current_breakpoint {
Breakpoint::Compact => COMPACT_SPACING,
Breakpoint::Medium => MEDIUM_SPACING,
_ => DEFAULT_SPACING,
}
} else {
DEFAULT_SPACING
}
}| Space::new() | ||
| .width(Length::Fixed(16.0)) | ||
| .height(Length::Fixed(16.0)) | ||
| .into() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The magic number 16.0 is used for spacing. To improve readability and maintainability, consider defining it as a constant, for example const ICON_SPACER_SIZE: f32 = 16.0;. This constant could then be used here and in other places where this spacing is required, like for channel indentation on lines 167 and 212.
Summary
Complete migration of the rustirc-gui crate from iced 0.13.1 to iced 0.14.0, resolving 82+ breaking API changes across 18 files. This is a major framework upgrade that brings reactive rendering improvements, time-travel debugging capabilities, and enhanced API design to the RustIRC GUI.
Breaking API Changes Resolved
Space::with_width/with_heightSpace::new().width/height()iced::application(title, update, view)iced::application(boot_fn, update, view).title()horizontal_space(),vertical_space()Space::new().width/height(Length::Fill)horizontal_rule(height)rule::horizontal(height)checkbox(label, value)checkbox(value).label(label)scrollable::Idiced::widget::Idscrollable::snap_tooperation::snap_totext_input::Status::Focused(unit)text_input::Status::Focused { is_hovered }(struct)snap: boolfield to button/container::Styleu16f32for Pixels trait boundsFiles Modified (18 total)
Core Application:
Cargo.toml- Version bump to iced 0.14.0crates/rustirc-gui/src/app.rs- Application API and rule widgetcrates/rustirc-gui/src/dialogs.rs- Space, checkbox, and max_width APIscrates/rustirc-gui/src/material_demo.rs- Application boot functionWidgets:
crates/rustirc-gui/src/widgets/message_view.rs- Scrollable ID and operationscrates/rustirc-gui/src/widgets/user_list.rs- Space widgetcrates/rustirc-gui/src/widgets/tab_bar.rs- Space widgetcrates/rustirc-gui/src/widgets/status_bar.rs- Space widgetcrates/rustirc-gui/src/widgets/server_tree.rs- Space widgetcrates/rustirc-gui/src/widgets/input_area.rs- Space widgetMaterial Design 3 Components:
crates/rustirc-gui/src/components/atoms/button.rs- button::Style snap fieldcrates/rustirc-gui/src/components/atoms/input.rs- text_input::Status patterncrates/rustirc-gui/src/components/molecules/message_bubble.rs- container::Style snap fieldcrates/rustirc-gui/src/components/molecules/search_bar.rs- text_input::Status patterncrates/rustirc-gui/src/components/organisms/responsive_layout.rs- Space widget and Pixels typecrates/rustirc-gui/src/components/organisms/rich_text_editor.rs- text_input::Status patternsTest plan
cargo clippy -- -D warnings)cargo run- GUI launches and functions correctlycargo run -- --material-demo- Material Design 3 demo worksQuality Assurance
Migration Notes
This migration was performed systematically by:
The
snap: boolfield added to Style structs controls whether the widget snaps to pixel boundaries for crisp rendering.Generated with Claude Code
Note
Major GUI framework upgrade with targeted refactors for Iced 0.14.0.
icedto0.14.0; switch toiced::application(boot_fn, update, view).title(...)inapp.rsandmaterial_demo.rsSpace::with_*/horizontal_space/vertical_space→Space::new().width/height(...)horizontal_rule→rule::horizontalcheckbox(label, value)→checkbox(value).label(label)scrollable::Id→iced::widget::Id;scrollable::snap_to→operation::snap_totext_input::Status::Focused(unit) →Focused { .. }pattern matchingsnap: booltobutton::Styleandcontainer::Style; adjust Pixels trait usages fromu16tof32message_view,user_list,tab_bar,status_bar,server_tree,input_area) to align with new APIsWritten by Cursor Bugbot for commit c7c4dac. This will update automatically on new commits. Configure here.