Skip to main content

Person

Trait Person 

Source
pub trait Person {
    // Required methods
    fn tell(&mut self, text: &str);
    fn answer(&mut self, ask: &Ask) -> Option<String>;
    fn approve(&mut self, ask: &Ask) -> Option<Verdict>;

    // Provided methods
    fn decide(&mut self, question: &str) -> Option<bool> { ... }
    fn choose(&mut self, question: &str, options: &[String]) -> Option<usize> { ... }
}
Expand description

The person the plan is for, and the people its steps name.

Required Methods§

Source

fn tell(&mut self, text: &str)

Tells them what happens.

Source

fn answer(&mut self, ask: &Ask) -> Option<String>

Asks for a text. None when they do not answer.

Source

fn approve(&mut self, ask: &Ask) -> Option<Verdict>

Asks them to approve work. None when they do not answer.

Provided Methods§

Source

fn decide(&mut self, question: &str) -> Option<bool>

Asks a yes or no question. None when they do not answer.

Source

fn choose(&mut self, question: &str, options: &[String]) -> Option<usize>

Asks them to choose one of the options. The one they chose, or None when they do not answer.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<R: BufRead, W: Write> Person for Terminal<R, W>