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

Update ViewSwitcher doc to be more accurate #1693

Merged
merged 5 commits into from
Apr 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ You can find its changes [documented below](#070---2021-01-01).
- Fixed docs of derived Lens ([#1523] by [@Maan2003])
- Use correct fill rule when rendering SVG paths ([#1606] by [@SecondFlight])
- Correctly capture and use stroke properties when rendering SVG paths ([#1647] by [@SecondFlight])
- Fixed docs describing `ViewSwitcher` widget functionality ([#1693] by [@arthmis])

### Visual

Expand Down Expand Up @@ -669,6 +670,7 @@ Last release without a changelog :(
[#1662]: https://github.com/linebender/druid/pull/1662
[#1677]: https://github.com/linebender/druid/pull/1677
[#1691]: https://github.com/linebender/druid/pull/1691
[#1693]: https://github.com/linebender/druid/pull/1693
[#1698]: https://github.com/linebender/druid/pull/1698

[Unreleased]: https://github.com/linebender/druid/compare/v0.7.0...master
Expand Down
5 changes: 1 addition & 4 deletions druid/src/widget/view_switcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,10 @@ use crate::widget::prelude::*;
use crate::{Data, Point, WidgetPod};
use tracing::instrument;

/// A widget that can switch dynamically between one of many views depending
/// on application state.

type ChildPicker<T, U> = dyn Fn(&T, &Env) -> U;
type ChildBuilder<T, U> = dyn Fn(&U, &T, &Env) -> Box<dyn Widget<T>>;

/// A widget that dynamically switches between two children.
/// A widget that switches dynamically between multiple children.
pub struct ViewSwitcher<T, U> {
child_picker: Box<ChildPicker<T, U>>,
child_builder: Box<ChildBuilder<T, U>>,
Expand Down