Allow render_match to return an Option to represent no matches

This commit is contained in:
Marshall Bowers 2023-11-28 10:33:13 -05:00
parent eac4b2d076
commit 63bd4ac999
4 changed files with 55 additions and 49 deletions

View file

@ -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,