Skip to main content

entrust_dialog/input/
prompt.rs

1use ratatui::text::Line;
2
3#[derive(Debug, Default, Clone)]
4pub struct Prompt<'p> {
5    pub(super) header: Line<'p>,
6    pub(super) inline: Line<'p>,
7}
8
9impl<'p> Prompt<'p> {
10    pub fn new<H, I>(header: H, inline: I) -> Self
11    where
12        H: Into<Line<'p>>,
13        I: Into<Line<'p>>,
14    {
15        Prompt {
16            header: header.into(),
17            inline: inline.into(),
18        }
19    }
20    pub fn header<H>(header: H) -> Self
21    where
22        H: Into<Line<'p>>,
23    {
24        Prompt::new(header, "")
25    }
26    pub fn inline<I>(inline: I) -> Self
27    where
28        I: Into<Line<'p>>,
29    {
30        Prompt::new("", inline)
31    }
32}