I have something like this:
#[derive(Debug, Clone, PartialEq, Eq)]
struct Item {
id: u32,
description: String,
}
impl std::fmt::Display for Item {
// ...
}
struct State {
items: Vec<Item>,
selected_item: Option<Item>,
dropdown: pick_list::State<Item>
}
// ...
fn view(&mut self) -> Element<Message> {
// ...
let dropdown = PickList::new(&mut self.dropdown,
&self.items,
self.selected_item,
Message::ItemSelected);
// ...
}
This does not work because the third parameter to PickList::new() takes an Option<T> and requires Copy to be implemented. This prevents any type that implements String from being used with PickList, which is highly limiting.
I have something like this:
This does not work because the third parameter to
PickList::new()takes anOption<T>and requiresCopyto be implemented. This prevents any type that implementsStringfrom being used withPickList, which is highly limiting.