Allow render_match
to return an Option
to represent no matches
This commit is contained in:
parent
eac4b2d076
commit
63bd4ac999
4 changed files with 55 additions and 49 deletions
|
@ -32,7 +32,7 @@ pub trait PickerDelegate: Sized + 'static {
|
|||
ix: usize,
|
||||
selected: bool,
|
||||
cx: &mut ViewContext<Picker<Self>>,
|
||||
) -> Self::ListItem;
|
||||
) -> Option<Self::ListItem>;
|
||||
}
|
||||
|
||||
impl<D: PickerDelegate> FocusableView for Picker<D> {
|
||||
|
@ -230,7 +230,7 @@ impl<D: PickerDelegate> Render for Picker<D> {
|
|||
)
|
||||
}),
|
||||
)
|
||||
.child(picker.delegate.render_match(
|
||||
.children(picker.delegate.render_match(
|
||||
ix,
|
||||
ix == selected_index,
|
||||
cx,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue