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§
Sourcefn log(
&mut self,
term: &mut dyn Terminal<W>,
message: String,
) -> Result<(), Error>
fn log( &mut self, term: &mut dyn Terminal<W>, message: String, ) -> Result<(), Error>
Output of messages without decoration.
Sourcefn info(
&mut self,
term: &mut dyn Terminal<W>,
message: String,
) -> Result<(), Error>
fn info( &mut self, term: &mut dyn Terminal<W>, message: String, ) -> Result<(), Error>
Output of messages with info decoration.
Sourcefn warn(
&mut self,
term: &mut dyn Terminal<W>,
message: String,
) -> Result<(), Error>
fn warn( &mut self, term: &mut dyn Terminal<W>, message: String, ) -> Result<(), Error>
Output of messages with warning decoration.
Sourcefn error(
&mut self,
term: &mut dyn Terminal<W>,
message: String,
) -> Result<(), Error>
fn error( &mut self, term: &mut dyn Terminal<W>, message: String, ) -> Result<(), Error>
Output of messages with error decoration.
Sourcefn success(
&mut self,
term: &mut dyn Terminal<W>,
message: String,
) -> Result<(), Error>
fn success( &mut self, term: &mut dyn Terminal<W>, message: String, ) -> Result<(), Error>
Output of messages with success decoration.
Sourcefn step(
&mut self,
term: &mut dyn Terminal<W>,
message: String,
) -> Result<(), Error>
fn step( &mut self, term: &mut dyn Terminal<W>, message: String, ) -> Result<(), Error>
Output of messages with a step decoration.
Sourcefn begin(
&mut self,
term: &mut dyn Terminal<W>,
intro: Option<String>,
) -> Result<(), Error>
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
.