[][src]Enum rucline::prompt::Outcome

pub enum Outcome {
    Accepted(String),
    Canceled(Buffer),
}

The outcome of read_line, being either accepted or canceled by the user.

Variants

Accepted(String)

If the user accepts the prompt input, i.e. an Accept event was emitted. this variant will contain the accepted text.

Canceled(Buffer)

If the user cancels the prompt input, i.e. a Cancel event was emitted. this variant will contain the rejected buffer, with text and cursor position intact from the moment of rejection.

Implementations

impl Outcome[src]

#[must_use]pub fn was_acceoted(&self) -> bool[src]

Returns true if the outcome was accepted.

#[must_use]pub fn unwrap(self) -> String[src]

Returns accepted text.

Panics

Panics if the Outcome is Canceled

#[must_use]pub fn some(self) -> Option<String>[src]

Converts this Outcome into an optional containing the accepted text.

Return

pub fn ok(self) -> Result<String, Buffer>[src]

Converts this Outcome into a result containing the accepted text or the canceled buffer.

Return

Errors

  • Buffer - If the user canceled the input.

Auto Trait Implementations

impl RefUnwindSafe for Outcome

impl Send for Outcome

impl Sync for Outcome

impl Unpin for Outcome

impl UnwindSafe for Outcome

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.