Skip to content

PickList requires Copy trait, severely limiting its use #572

Description

@olson-dan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions