Skip to content

Commit

Permalink
Update ViewSwitcher doc to be more accurate (#1693)
Browse files Browse the repository at this point in the history
* updating viewswitcher doc to be more accurate

* Update druid/src/widget/view_switcher.rs

* updating changelog

Co-authored-by: lazypassion <[email protected]>
Co-authored-by: Colin Rofls <[email protected]>
  • Loading branch information
3 people authored Apr 7, 2021
1 parent 6de93b2 commit 34e864d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
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

0 comments on commit 34e864d

Please sign in to comment.