pub struct IntPrompt { /* private fields */ }Expand description
Ask for a whole number. Port of rich.prompt.IntPrompt.
Implementations§
Source§impl IntPrompt
impl IntPrompt
pub fn new(prompt: impl Into<String>) -> Self
pub fn show_default(self, show: bool) -> Self
Sourcepub fn make_prompt(&self, console: &Console, default: Option<i64>) -> Text
pub fn make_prompt(&self, console: &Console, default: Option<i64>) -> Text
The rendered question, as ask would print it.
Sourcepub fn process_response(&self, value: &str) -> Result<i64, InvalidResponse>
pub fn process_response(&self, value: &str) -> Result<i64, InvalidResponse>
Parse one answer, rejecting anything that is not a number.
pub fn ask(&self, console: &Console, default: Option<i64>) -> Result<i64>
pub fn ask_from( &self, console: &Console, input: &mut dyn InputSource, default: Option<i64>, ) -> Result<i64>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IntPrompt
impl RefUnwindSafe for IntPrompt
impl Send for IntPrompt
impl Sync for IntPrompt
impl Unpin for IntPrompt
impl UnsafeUnpin for IntPrompt
impl UnwindSafe for IntPrompt
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