pub fn error(
        &mut self,
        code: Option<&str>,
        short: &str,
        message: Option<&str>,
    ) -> CalResult<&mut Self> {
        self.buf.set_color(
            ColorSpec::new()
                .set_fg(Some(Color::Red))
                .set_bold(true)
                .set_intense(true),
        )?;
        write!(self.buf, "error")?;
        if let Some(code) = code {
            write!(self.buf, "[{}]", code)?;
        }
        write!(self.buf, ": ")?;
        self.buf.set_color(
            ColorSpec::new()
                .set_fg(Some(Color::White))
                .set_bold(true)
                .set_intense(true),
        )?;
        write!(self.buf, "{}", short)?;
        if let Some(message) = message {
            write!(self.buf, ": ")?;
            self.buf.reset()?;
            write!(self.buf, "{}", message)?;
        }
        writeln!(self.buf)?;
        Ok(self)
    }
/// Emit an error. Note that this function **will** reset the existing
/// color of the internal buffer. The emitted text will have a newline.
///
/// # Forms
///
/// Angle brackets (`<>`) indicate a string provided to the function.
///
/// ## Without `code` or `message`
///
/// ```text
/// error: <short>
/// ```
///
/// ## With `code` but not `message`
///
/// ```text
/// error[<code>]: <short>
/// ```
///
/// ## With `message` but not `code`
///
/// ```text
/// error: <short>: <message>
/// ```
///
/// ## With `code` and `message`
///
/// ```text
/// error[<code>]: <short>: <message>
/// ```
///
/// # Color
///
/// When color is enabled for the output provided, the segments will be
/// colored as such:
///
/// - `error[<code>]`: Red; bold, intense
/// - `<short>`: White; bold, intense
/// - `<message>`: Default color
///
/// # Errors
///
/// This function will error if at any point text could not be written to
/// the internal buffer.
Emit an error. Note that this function **will** reset the existing
color of the internal buffer. The emitted text will have a newline.
Emit an error . Note that this function ** will ** reset the existing color of the internal buffer . The emitted text will have a newline .
pub fn error(
        &mut self,
        code: Option<&str>,
        short: &str,
        message: Option<&str>,
    ) -> CalResult<&mut Self> {
        self.buf.set_color(
            ColorSpec::new()
                .set_fg(Some(Color::Red))
                .set_bold(true)
                .set_intense(true),
        )?;
        write!(self.buf, "error")?;
        if let Some(code) = code {
            write!(self.buf, "[{}]", code)?;
        }
        write!(self.buf, ": ")?;
        self.buf.set_color(
            ColorSpec::new()
                .set_fg(Some(Color::White))
                .set_bold(true)
                .set_intense(true),
        )?;
        write!(self.buf, "{}", short)?;
        if let Some(message) = message {
            write!(self.buf, ": ")?;
            self.buf.reset()?;
            write!(self.buf, "{}", message)?;
        }
        writeln!(self.buf)?;
        Ok(self)
    }
pub fn error ( & mut self , code : Option < & str > , short : & str , message : Option < & str > , ) -> CalResult < & mut Self > { self . buf . set_color ( ColorSpec :: new ( ) . set_fg ( Some ( Color :: Red ) ) . set_bold ( true ) . set_intense ( true ) , ) ? ; write ! ( self buf " " ) ? ; if let Some ( code ) = code { write ! ( self buf " " code ) ? ; } write ! ( self buf " " ) ? ; self . buf . set_color ( ColorSpec :: new ( ) . set_fg ( Some ( Color :: White ) ) . set_bold ( true ) . set_intense ( true ) , ) ? ; write ! ( self buf " " short ) ? ; if let Some ( message ) = message { write ! ( self buf " " ) ? ; self . buf . reset ( ) ? ; write ! ( self buf " " message ) ? ; } writeln ! ( self buf ) ? ; Ok ( self ) }
Emit an error.
Emit an error .
&mut self
code
Option<&str>
short
&str
message
Option<&str>
&mut self
code
Option<&str>
short
&str
message
Option<&str>
forms
Angle brackets (`<>`) indicate a string provided to the function.
Angle brackets ( ` < > ` ) indicate a string provided to the function .
without `code` or `message`
None
with `code` but not `message`
None
with `message` but not `code`
None
with `code` and `message`
None
color
When color is enabled for the output provided, the segments will be
colored as such.

`error[]`: Red; bold, intense
``: White; bold, intense
``: Default color
When color is enabled for the output provided the segments will be colored as such . ` error [] ` : Red ; bold intense ` ` : White ; bold intense ` ` : Default color
errors
This function will error if at any point text could not be written to
the internal buffer.
This function will error if at any point text could not be written to the internal buffer .