[−][src]Enum inkling::Prompt
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.
Methods
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
Auto Trait Implementations
impl Sync for Prompt
impl Unpin for Prompt
impl Send for Prompt
impl UnwindSafe for Prompt
impl RefUnwindSafe for Prompt
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,