Display text for selected values in selection order.
(
values: impl IntoIterator<Item = &'a RcPartialEqValue>,
options: &[OptionState],
)
| 80 | |
| 81 | /// Display text for selected values in selection order. |
| 82 | pub(crate) fn selected_text<'a>( |
| 83 | values: impl IntoIterator<Item = &'a RcPartialEqValue>, |
| 84 | options: &[OptionState], |
| 85 | ) -> Option<String> { |
| 86 | let parts: Vec<String> = values |
| 87 | .into_iter() |
| 88 | .filter_map(|value| { |
| 89 | options |
| 90 | .iter() |
| 91 | .find(|option| &option.value == value) |
| 92 | .map(|option| option.text_value.clone()) |
| 93 | }) |
| 94 | .collect(); |
| 95 | |
| 96 | (!parts.is_empty()).then(|| parts.join(", ")) |
| 97 | } |
| 98 | |
| 99 | /// Insert or update a registered option. |
| 100 | pub(crate) fn sync_option(mut options: Signal<Vec<OptionState>>, option_state: OptionState) { |
no test coverage detected