inquire/prompts/custom_type/
action.rs

1use crate::{ui::Key, InnerAction, InputAction};
2
3use super::config::CustomTypeConfig;
4
5/// Set of actions for a CustomTypePrompt.
6#[derive(Copy, Clone, Debug, PartialEq, Eq)]
7pub enum CustomTypePromptAction {
8    /// Action on the value text input handler.
9    ValueInput(InputAction),
10}
11
12impl InnerAction for CustomTypePromptAction {
13    type Config = CustomTypeConfig;
14
15    fn from_key(key: Key, _config: &CustomTypeConfig) -> Option<Self> {
16        let action = match InputAction::from_key(key, &()) {
17            Some(action) => Self::ValueInput(action),
18            None => return None,
19        };
20
21        Some(action)
22    }
23}