pub struct Prompt<'a> { /* private fields */ }Expand description
Untyped builder for reading and parsing CLI input.
Implementations§
Source§impl<'a> Prompt<'a>
impl<'a> Prompt<'a>
Sourcepub fn default(self, default: &str) -> Self
pub fn default(self, default: &str) -> Self
Provide a default value as string. If the user hits ENTER with empty input,
default will be used and parsed as the target type.
Sourcepub fn retries(self, retries: usize) -> Self
pub fn retries(self, retries: usize) -> Self
Number of times to retry when parsing fails or input is empty w/o default.
Sourcepub fn to<T>(self) -> TypedPrompt<'a, T>
pub fn to<T>(self) -> TypedPrompt<'a, T>
Convert to a typed builder, enabling .default_val() and .validate().
Examples found in repository?
More examples
Auto Trait Implementations§
impl<'a> Freeze for Prompt<'a>
impl<'a> RefUnwindSafe for Prompt<'a>
impl<'a> Send for Prompt<'a>
impl<'a> Sync for Prompt<'a>
impl<'a> Unpin for Prompt<'a>
impl<'a> UnwindSafe for Prompt<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more