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, 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
Source§fn clone(&self) -> FloatPrompt
fn clone(&self) -> FloatPrompt
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto 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