fn fmt_with<S: fmt::Write>(&self, s: &mut S, fmt: &Format<'_>, opt: bool) -> fmt::Result {
        s.write_str(fmt.prefix)?;
        s.write_str(self.msg)?;

        // Field details
        if opt || self.example.is_some() || self.default.is_some() {
            s.write_str(" (")?;

            // - Example
            if let Some(e) = self.example {
                write!(s, "example: {}", e)?;
                if opt || self.fmt.show_default && self.default.is_some() {
                    s.write_str(", ")?;
                }
            }

            // - Default
            match self.default {
                Some(ref d) if self.fmt.show_default => write!(s, "default: {}", d)?,
                _ => (),
            }

            // - Optional
            if opt && self.default.is_none() {
                s.write_str("optional")?;
            }

            s.write_str(")")?;
        }

        match fmt.line_brk {
            true => s.write_char('\n'),
            false => Ok(()),
        }
    }
/// Displays the message of the written field with a given prefix.
///
/// This is used to prompt the written field with a given [`Format`]
/// (see [`Written::prompt_with`] function for example).
Displays the message of the written field with a given prefix.
This is used to prompt the written field with a given [`Format`]
.
Displays the message of the written field with a given prefix . This is used to prompt the written field with a given [ ` Format ` ] .
fn fmt_with<S: fmt::Write>(&self, s: &mut S, fmt: &Format<'_>, opt: bool) -> fmt::Result {
        s.write_str(fmt.prefix)?;
        s.write_str(self.msg)?;
        // Field details
        if opt || self.example.is_some() || self.default.is_some() {
            s.write_str(" (")?;
            // - Example
            if let Some(e) = self.example {
                write!(s, "example: {}", e)?;
                if opt || self.fmt.show_default && self.default.is_some() {
                    s.write_str(", ")?;
                }
            }
            // - Default
            match self.default {
                Some(ref d) if self.fmt.show_default => write!(s, "default: {}", d)?,
                _ => (),
            }
            // - Optional
            if opt && self.default.is_none() {
                s.write_str("optional")?;
            }
            s.write_str(")")?;
        }
        match fmt.line_brk {
            true => s.write_char('\n'),
            false => Ok(()),
        }
    }
fn fmt_with < S : fmt :: Write > ( & self , s : & mut S , fmt : & Format < ' _ > , opt : bool ) -> fmt :: Result { s . write_str ( fmt . prefix ) ? ; s . write_str ( self . msg ) ? ; // Field details if opt || self . example . is_some ( ) || self . default . is_some ( ) { s . write_str ( " " ) ? ; // - Example if let Some ( e ) = self . example { write ! ( s " " e ) ? ; if opt || self . fmt . show_default && self . default . is_some ( ) { s . write_str ( " " ) ? ; } } // - Default match self . default { Some ( ref d ) if self . fmt . show_default => write ! ( s " " d ) ? , _ => ( ) , } // - Optional if opt && self . default . is_none ( ) { s . write_str ( " " ) ? ; } s . write_str ( " " ) ? ; } match fmt . line_brk { true => s . write_char ( '\n' ) , false => Ok ( ( ) ) , } }
Displays the message of the written field with a given prefix.
Displays the message of the written field with a given prefix .
&self
s
&mut S
fmt
&Format<'_>
opt
bool