pub trait SelectValue:
Clone
+ PartialEq
+ 'static {
// Required method
fn key(&self) -> SharedString;
}Expand description
The value of a SelectItem: the item’s identity in the menu.
The key names the row’s element id, so it is stable across frames and unique in the menu. Strings and integers are values already; an application’s own enum or record implements this with its id.
use gpui_cn::SelectValue;
use gpui_kit::SharedString;
#[derive(Clone, PartialEq)]
enum Effort {
Low,
High,
}
impl SelectValue for Effort {
fn key(&self) -> SharedString {
match self {
Self::Low => "low".into(),
Self::High => "high".into(),
}
}
}Required Methods§
Sourcefn key(&self) -> SharedString
fn key(&self) -> SharedString
The stable name of the value’s row.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".