Lines Matching full:style
10 /// Call [`Formatter::style`] to get a `Style` and use the builder methods to
12 /// To print a value using the style, wrap it in a call to [`value`] when the log
17 /// Create a bold, red colored style and use it to print the log level:
26 /// let mut level_style = buf.style();
45 /// let mut bold = buf.style();
56 /// [`Formatter::style`]: struct.Formatter.html#method.style
61 pub struct Style { struct
66 impl Style { impl
71 /// Create a style with red text:
80 /// let mut style = buf.style();
82 /// style.set_color(Color::Red);
84 /// writeln!(buf, "{}", style.value(record.args()))
87 pub fn set_color(&mut self, color: Color) -> &mut Style { in set_color() argument
99 /// Create a style with bold text:
107 /// let mut style = buf.style();
109 /// style.set_bold(true);
111 /// writeln!(buf, "{}", style.value(record.args()))
114 pub fn set_bold(&mut self, yes: bool) -> &mut Style { in set_bold() argument
126 /// Create a style with intense text:
134 /// let mut style = buf.style();
136 /// style.set_intense(true);
138 /// writeln!(buf, "{}", style.value(record.args()))
141 pub fn set_intense(&mut self, yes: bool) -> &mut Style { in set_intense() argument
153 /// Create a style with dimmed text:
161 /// let mut style = buf.style();
163 /// style.set_dimmed(true);
165 /// writeln!(buf, "{}", style.value(record.args()))
168 pub fn set_dimmed(&mut self, yes: bool) -> &mut Style { in set_dimmed() argument
177 /// Create a style with a yellow background:
186 /// let mut style = buf.style();
188 /// style.set_bg(Color::Yellow);
190 /// writeln!(buf, "{}", style.value(record.args()))
193 pub fn set_bg(&mut self, color: Color) -> &mut Style { in set_bg() argument
198 /// Wrap a value in the style.
200 /// The same `Style` can be used to print multiple different values.
204 /// Create a bold, red colored style and use it to print the log level:
213 /// let mut style = buf.style();
215 /// style.set_color(Color::Red).set_bold(true);
218 /// style.value(record.level()),
224 style: Cow::Borrowed(self), in value()
229 /// Wrap a value in the style by taking ownership of it.
232 style: Cow::Owned(self), in into_value()
238 impl fmt::Debug for Style { implementation
240 f.debug_struct("Style").field("spec", &self.spec).finish() in fmt()
246 /// It is the result of calling [`Style::value`].
248 /// [`Style::value`]: struct.Style.html#method.value
250 style: Cow<'a, Style>, field
259 self.style in write_fmt()
262 .set_color(&self.style.spec) in write_fmt()
265 // Always try to reset the terminal style, even if writing failed in write_fmt()
267 let reset = self.style.buf.borrow_mut().reset().map_err(|_| fmt::Error); in write_fmt()