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