Struct requestty_ui::widgets::Prompt
source · [−]pub struct Prompt<M, H = &'static str> { /* private fields */ }
Expand description
A generic prompt that renders a message and an optional hint.
Implementations
sourceimpl<M: AsRef<str>, H: AsRef<str>> Prompt<M, H>
impl<M: AsRef<str>, H: AsRef<str>> Prompt<M, H>
sourcepub fn with_optional_hint(self, hint: Option<H>) -> Self
pub fn with_optional_hint(self, hint: Option<H>) -> Self
Sets the hint
sourcepub fn with_delim(self, delim: Delimiter) -> Self
pub fn with_delim(self, delim: Delimiter) -> Self
Sets the hint delimiter
sourcepub fn into_message(self) -> M
pub fn into_message(self) -> M
Consume self returning the owned message
sourcepub fn into_message_and_hint(self) -> (M, Option<H>)
pub fn into_message_and_hint(self) -> (M, Option<H>)
Consume self returning the owned message and hint
sourcepub fn message_len(&self) -> u16
pub fn message_len(&self) -> u16
The character length of the message
Trait Implementations
sourceimpl<M: AsRef<str>, H: AsRef<str>> Widget for Prompt<M, H>
impl<M: AsRef<str>, H: AsRef<str>> Widget for Prompt<M, H>
sourcefn render<B: Backend>(&mut self, layout: &mut Layout, b: &mut B) -> Result<()>
fn render<B: Backend>(&mut self, layout: &mut Layout, b: &mut B) -> Result<()>
Render to a given backend. Read more
sourcefn height(&mut self, layout: &mut Layout) -> u16
fn height(&mut self, layout: &mut Layout) -> u16
The number of rows of the terminal the widget will take when rendered. Read more
sourcefn cursor_pos(&mut self, layout: Layout) -> (u16, u16)
fn cursor_pos(&mut self, layout: Layout) -> (u16, u16)
The position of the cursor to be placed at after render. The returned value should be in the form of (x, y), with (0, 0) being the top left of the screen. Read more
sourcefn handle_key(&mut self, _: KeyEvent) -> bool
fn handle_key(&mut self, _: KeyEvent) -> bool
Handle a key input. It should return whether key was handled.
Auto Trait Implementations
impl<M, H> RefUnwindSafe for Prompt<M, H> where
H: RefUnwindSafe,
M: RefUnwindSafe,
impl<M, H> Send for Prompt<M, H> where
H: Send,
M: Send,
impl<M, H> Sync for Prompt<M, H> where
H: Sync,
M: Sync,
impl<M, H> Unpin for Prompt<M, H> where
H: Unpin,
M: Unpin,
impl<M, H> UnwindSafe for Prompt<M, H> where
H: UnwindSafe,
M: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more