[][src]Enum inkling::Prompt

pub enum Prompt {
    Done,
    Choice(Vec<Choice>),
}

Result from following a Story.

Examples

let content = "\
Professor Lidenbrock had barely a spattering of water left in his flask.
*   Axel got the last of it.
*   He pressed on, desperately hoping to find water soon.
";

let mut story = read_story_from_string(content).unwrap();
let mut line_buffer = Vec::new();

story.start().unwrap();

match story.resume(&mut line_buffer).unwrap() {
    Prompt::Choice(choice_set) => {
        println!("Choose:");
        for (i, choice) in choice_set.iter().enumerate() {
            println!("{}. {}", i + 1, choice.text);
        }
    },
    Prompt::Done => { /* the story reached its end */ },
}

Variants

Done

The story reached an end.

Choice(Vec<Choice>)

A choice was encountered.

Implementations

impl Prompt[src]

pub fn get_choices(&self) -> Option<Vec<Choice>>[src]

If a set of choices was returned, retrieve them without having to match.

Examples

let content = "\
Professor Lidenbrock had barely a spattering of water left in his flask.
*   Axel got the last of it.
*   He pressed on, desperately hoping to find water soon.
";

let mut story = read_story_from_string(content).unwrap();
let mut line_buffer = Vec::new();

story.start().unwrap();

if let Some(choices) = story.resume(&mut line_buffer).unwrap().get_choices() {
    /* do what you want */
}

Trait Implementations

impl Debug for Prompt[src]

Auto Trait Implementations

impl RefUnwindSafe for Prompt

impl Send for Prompt

impl Sync for Prompt

impl Unpin for Prompt

impl UnwindSafe for Prompt

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.