use crate::styled_buffer::StyledBuffer;
pub trait Prompt {
fn prompt(&self) -> StyledBuffer;
}
pub struct StringPrompt {
text: String,
}
impl StringPrompt {
#[must_use]
pub fn new(text: String) -> Self {
StringPrompt { text }
}
}
impl Prompt for StringPrompt {
fn prompt(&self) -> StyledBuffer {
let mut buffer = StyledBuffer::default();
buffer.insert_string(&self.text);
buffer
}
}