nom_kconfig/entry/
main_menu.rs

1use nom::{bytes::complete::tag, combinator::map, sequence::pair, IResult, Parser};
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    )
16    .parse(input)
17}
18
19/// 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.
20#[derive(Debug, Default, Clone, PartialEq)]
21#[cfg_attr(feature = "hash", derive(Hash))]
22#[cfg_attr(feature = "serialize", derive(Serialize))]
23#[cfg_attr(feature = "deserialize", derive(Deserialize))]
24pub struct MainMenu {
25    pub prompt: String,
26}