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

refactor(colors_rgb): impl widget on mutable refs #865

Merged
merged 1 commit into from
Jan 24, 2024
Merged

Conversation

joshka
Copy link
Member

@joshka joshka commented Jan 24, 2024

This commit refactors the colors_rgb example to implement the Widget
trait on mutable references to the app and its sub-widgets. This allows
the app to update its state while it is being rendered.

Additionally the main and run functions are refactored to be similar to
the other recent examples. This uses a pattern where the App struct has
a run method that takes a terminal as an argument, and the main
function is in control of initizing and restoring the terminal and
installing the error hooks.

Copy link
Member

@orhun orhun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Also just tested and it works.

Copy link
Member

@Valentin271 Valentin271 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than my comment looks good

This commit refactors the colors_rgb example to implement the Widget
trait on mutable references to the app and its sub-widgets. This allows
the app to update its state while it is being rendered.

Additionally the main and run functions are refactored to be similar to
the other recent examples. This uses a pattern where the App struct has
a `run` method that takes a terminal as an argument, and the main
function is in control of initizing and restoring the terminal and
installing the error hooks.
@joshka joshka force-pushed the refactor-colors-rgb branch from 1032348 to 629eedb Compare January 24, 2024 14:51
@joshka joshka merged commit 7f42ec9 into main Jan 24, 2024
34 checks passed
@joshka joshka deleted the refactor-colors-rgb branch January 24, 2024 15:13
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.

3 participants