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
Changes from 1 commit
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
6 changes: 2 additions & 4 deletions druid/src/widget/view_switcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ 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 can switch dynamically between one of many views depending
/// on application state.
cmyr marked this conversation as resolved.
Show resolved Hide resolved
pub struct ViewSwitcher<T, U> {
child_picker: Box<ChildPicker<T, U>>,
child_builder: Box<ChildBuilder<T, U>>,
Expand Down