Trait Theme

Source
pub trait Theme<W: Write> {
    // Required methods
    fn log(
        &mut self,
        term: &mut dyn Terminal<W>,
        message: String,
    ) -> Result<(), Error>;
    fn info(
        &mut self,
        term: &mut dyn Terminal<W>,
        message: String,
    ) -> Result<(), Error>;
    fn warn(
        &mut self,
        term: &mut dyn Terminal<W>,
        message: String,
    ) -> Result<(), Error>;
    fn error(
        &mut self,
        term: &mut dyn Terminal<W>,
        message: String,
    ) -> Result<(), Error>;
    fn success(
        &mut self,
        term: &mut dyn Terminal<W>,
        message: String,
    ) -> Result<(), Error>;
    fn step(
        &mut self,
        term: &mut dyn Terminal<W>,
        message: String,
    ) -> Result<(), Error>;
    fn begin(
        &mut self,
        term: &mut dyn Terminal<W>,
        intro: Option<String>,
    ) -> Result<(), Error>;
    fn render(
        &mut self,
        term: &mut dyn Terminal<W>,
        payload: RenderSnapshot<'_>,
    ) -> Result<(), Error>;
    fn finish(
        &mut self,
        term: &mut dyn Terminal<W>,
        state: &PromptState,
        outro: Option<String>,
    ) -> Result<(), Error>;
}
Expand description

A trait for the Theme that determines what Promptuity renders.

Required Methods§

Source

fn log( &mut self, term: &mut dyn Terminal<W>, message: String, ) -> Result<(), Error>

Output of messages without decoration.

Source

fn info( &mut self, term: &mut dyn Terminal<W>, message: String, ) -> Result<(), Error>

Output of messages with info decoration.

Source

fn warn( &mut self, term: &mut dyn Terminal<W>, message: String, ) -> Result<(), Error>

Output of messages with warning decoration.

Source

fn error( &mut self, term: &mut dyn Terminal<W>, message: String, ) -> Result<(), Error>

Output of messages with error decoration.

Source

fn success( &mut self, term: &mut dyn Terminal<W>, message: String, ) -> Result<(), Error>

Output of messages with success decoration.

Source

fn step( &mut self, term: &mut dyn Terminal<W>, message: String, ) -> Result<(), Error>

Output of messages with a step decoration.

Source

fn begin( &mut self, term: &mut dyn Terminal<W>, intro: Option<String>, ) -> Result<(), Error>

Renders the start of a prompt session.
It can render a title or message received as intro.

Source

fn render( &mut self, term: &mut dyn Terminal<W>, payload: RenderSnapshot<'_>, ) -> Result<(), Error>

Renders the prompt.

Source

fn finish( &mut self, term: &mut dyn Terminal<W>, state: &PromptState, outro: Option<String>, ) -> Result<(), Error>

Renders the end of a prompt session.
It can render a message received as outro.

Implementors§