Skip to content

Commit b2fa5eb

Browse files
committed
docs: Dont bury Renderer::render
1 parent a121d98 commit b2fa5eb

File tree

1 file changed

+69
-66
lines changed

1 file changed

+69
-66
lines changed

src/renderer/mod.rs

Lines changed: 69 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -174,72 +174,6 @@ impl Renderer {
174174
self.decor_style = decor_style;
175175
self
176176
}
177-
178-
/// Override the output style for `error`
179-
pub const fn error(mut self, style: Style) -> Self {
180-
self.stylesheet.error = style;
181-
self
182-
}
183-
184-
/// Override the output style for `warning`
185-
pub const fn warning(mut self, style: Style) -> Self {
186-
self.stylesheet.warning = style;
187-
self
188-
}
189-
190-
/// Override the output style for `info`
191-
pub const fn info(mut self, style: Style) -> Self {
192-
self.stylesheet.info = style;
193-
self
194-
}
195-
196-
/// Override the output style for `note`
197-
pub const fn note(mut self, style: Style) -> Self {
198-
self.stylesheet.note = style;
199-
self
200-
}
201-
202-
/// Override the output style for `help`
203-
pub const fn help(mut self, style: Style) -> Self {
204-
self.stylesheet.help = style;
205-
self
206-
}
207-
208-
/// Override the output style for line numbers
209-
pub const fn line_num(mut self, style: Style) -> Self {
210-
self.stylesheet.line_num = style;
211-
self
212-
}
213-
214-
/// Override the output style for emphasis
215-
pub const fn emphasis(mut self, style: Style) -> Self {
216-
self.stylesheet.emphasis = style;
217-
self
218-
}
219-
220-
/// Override the output style for none
221-
pub const fn none(mut self, style: Style) -> Self {
222-
self.stylesheet.none = style;
223-
self
224-
}
225-
226-
/// Override the output style for [`AnnotationKind::Context`]
227-
pub const fn context(mut self, style: Style) -> Self {
228-
self.stylesheet.context = style;
229-
self
230-
}
231-
232-
/// Override the output style for additions
233-
pub const fn addition(mut self, style: Style) -> Self {
234-
self.stylesheet.addition = style;
235-
self
236-
}
237-
238-
/// Override the output style for removals
239-
pub const fn removal(mut self, style: Style) -> Self {
240-
self.stylesheet.removal = style;
241-
self
242-
}
243177
}
244178

245179
impl Renderer {
@@ -2620,6 +2554,75 @@ impl Renderer {
26202554
}
26212555
}
26222556

2557+
/// Customize [`Renderer::styled`]
2558+
impl Renderer {
2559+
/// Override the output style for `error`
2560+
pub const fn error(mut self, style: Style) -> Self {
2561+
self.stylesheet.error = style;
2562+
self
2563+
}
2564+
2565+
/// Override the output style for `warning`
2566+
pub const fn warning(mut self, style: Style) -> Self {
2567+
self.stylesheet.warning = style;
2568+
self
2569+
}
2570+
2571+
/// Override the output style for `info`
2572+
pub const fn info(mut self, style: Style) -> Self {
2573+
self.stylesheet.info = style;
2574+
self
2575+
}
2576+
2577+
/// Override the output style for `note`
2578+
pub const fn note(mut self, style: Style) -> Self {
2579+
self.stylesheet.note = style;
2580+
self
2581+
}
2582+
2583+
/// Override the output style for `help`
2584+
pub const fn help(mut self, style: Style) -> Self {
2585+
self.stylesheet.help = style;
2586+
self
2587+
}
2588+
2589+
/// Override the output style for line numbers
2590+
pub const fn line_num(mut self, style: Style) -> Self {
2591+
self.stylesheet.line_num = style;
2592+
self
2593+
}
2594+
2595+
/// Override the output style for emphasis
2596+
pub const fn emphasis(mut self, style: Style) -> Self {
2597+
self.stylesheet.emphasis = style;
2598+
self
2599+
}
2600+
2601+
/// Override the output style for none
2602+
pub const fn none(mut self, style: Style) -> Self {
2603+
self.stylesheet.none = style;
2604+
self
2605+
}
2606+
2607+
/// Override the output style for [`AnnotationKind::Context`]
2608+
pub const fn context(mut self, style: Style) -> Self {
2609+
self.stylesheet.context = style;
2610+
self
2611+
}
2612+
2613+
/// Override the output style for additions
2614+
pub const fn addition(mut self, style: Style) -> Self {
2615+
self.stylesheet.addition = style;
2616+
self
2617+
}
2618+
2619+
/// Override the output style for removals
2620+
pub const fn removal(mut self, style: Style) -> Self {
2621+
self.stylesheet.removal = style;
2622+
self
2623+
}
2624+
}
2625+
26232626
trait MessageOrTitle {
26242627
fn level(&self) -> &Level<'_>;
26252628
fn id(&self) -> Option<&Id<'_>>;

0 commit comments

Comments
 (0)