nom_kconfig/entry/
main_menu.rs

1use nom::{bytes::complete::tag, combinator::map, sequence::pair, IResult};
2#[cfg(feature = "deserialize")]
3use serde::Deserialize;
4#[cfg(feature = "serialize")]
5use serde::Serialize;
6
7use crate::{attribute::parse_prompt_value, util::ws, KconfigInput};
8
9pub fn parse_main_menu(input: KconfigInput) -> IResult<KconfigInput, MainMenu> {
10    map(
11        pair(ws(tag("mainmenu")), ws(parse_prompt_value)),
12        |(_, prompt)| MainMenu {
13            prompt: prompt.to_string(),
14        },
15    )(input)
16}
17
18/// This sets the config program's title bar if the config program chooses to use it. It should be placed at the top of the configuration, before any other statement.
19#[derive(Debug, Default, Clone, PartialEq)]
20#[cfg_attr(feature = "hash", derive(Hash))]
21#[cfg_attr(feature = "serialize", derive(Serialize))]
22#[cfg_attr(feature = "deserialize", derive(Deserialize))]
23pub struct MainMenu {
24    pub prompt: String,
25}