| 1 | use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/::Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#; |
| 2 | |
| 3 | #[cfg(feature = "termcolor")] |
| 4 | use { |
| 5 | craterust-analyzer cargo codespan-reporting 0.12.0 crate/::diagnosticrust-analyzer cargo codespan-reporting 0.12.0 diagnostic/::{LabelStylerust-analyzer cargo codespan-reporting 0.12.0 diagnostic/LabelStyle#, Severityrust-analyzer cargo codespan-reporting 0.12.0 diagnostic/Severity#}, |
| 6 | termcolorrust-analyzer cargo termcolor 1.4.1 crate/::{Colorrust-analyzer cargo termcolor 1.4.1 Color#, ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec#}, |
| 7 | }; |
| 8 | |
| 9 | /// Configures how a diagnostic is rendered. |
| 10 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 11 | pub struct Configrust-analyzer cargo codespan-reporting 0.12.0 term/config/Config# { |
| 12 | /// The display style to use when rendering diagnostics. |
| 13 | /// Defaults to: [`DisplayStyle::Rich`]. |
| 14 | /// |
| 15 | /// [`DisplayStyle::Rich`]: DisplayStyle::Rich |
| 16 | pub display_stylerust-analyzer cargo codespan-reporting 0.12.0 term/config/Config#display_style.: DisplayStylerust-analyzer cargo codespan-reporting 0.12.0 term/config/DisplayStyle#, |
| 17 | /// Column width of tabs. |
| 18 | /// Defaults to: `4`. |
| 19 | pub tab_widthrust-analyzer cargo codespan-reporting 0.12.0 term/config/Config#tab_width.: usize, |
| 20 | /// Styles to use when rendering the diagnostic. |
| 21 | #[cfg(feature = "termcolor")] |
| 22 | pub stylesrust-analyzer cargo codespan-reporting 0.12.0 term/config/Config#styles.: Stylesrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#, |
| 23 | /// Characters to use when rendering the diagnostic. |
| 24 | pub charsrust-analyzer cargo codespan-reporting 0.12.0 term/config/Config#chars.: Charsrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#, |
| 25 | /// The minimum number of lines to be shown after the line on which a multiline [`Label`] begins. |
| 26 | /// |
| 27 | /// Defaults to: `3`. |
| 28 | /// |
| 29 | /// [`Label`]: crate::diagnostic::Label |
| 30 | pub start_context_linesrust-analyzer cargo codespan-reporting 0.12.0 term/config/Config#start_context_lines.: usize, |
| 31 | /// The minimum number of lines to be shown before the line on which a multiline [`Label`] ends. |
| 32 | /// |
| 33 | /// Defaults to: `1`. |
| 34 | /// |
| 35 | /// [`Label`]: crate::diagnostic::Label |
| 36 | pub end_context_linesrust-analyzer cargo codespan-reporting 0.12.0 term/config/Config#end_context_lines.: usize, |
| 37 | /// The minimum number of lines before a label that should be included for context. |
| 38 | /// |
| 39 | /// Defaults to: `0`. |
| 40 | pub before_label_linesrust-analyzer cargo codespan-reporting 0.12.0 term/config/Config#before_label_lines.: usize, |
| 41 | /// The minimum number of lines after a label that should be included for context. |
| 42 | /// |
| 43 | /// Defaults to: `0`. |
| 44 | pub after_label_linesrust-analyzer cargo codespan-reporting 0.12.0 term/config/Config#after_label_lines.: usize, |
| 45 | } |
| 46 | |
| 47 | impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for Configrust-analyzer cargo codespan-reporting 0.12.0 term/config/Config# { |
| 48 | fn defaultrust-analyzer cargo codespan-reporting 0.12.0 term/config/impl#[Config][Default]default().() -> Configrust-analyzer cargo codespan-reporting 0.12.0 term/config/Config# { |
| 49 | Configrust-analyzer cargo codespan-reporting 0.12.0 term/config/Config# { |
| 50 | display_stylerust-analyzer cargo codespan-reporting 0.12.0 term/config/Config#display_style.: DisplayStylerust-analyzer cargo codespan-reporting 0.12.0 term/config/DisplayStyle#::Richrust-analyzer cargo codespan-reporting 0.12.0 term/config/DisplayStyle#Rich#, |
| 51 | tab_widthrust-analyzer cargo codespan-reporting 0.12.0 term/config/Config#tab_width.: 4, |
| 52 | #[cfg(feature = "termcolor")] |
| 53 | stylesrust-analyzer cargo codespan-reporting 0.12.0 term/config/Config#styles.: Stylesrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#::defaultrust-analyzer cargo codespan-reporting 0.12.0 term/config/impl#[Styles][Default]default().(), |
| 54 | charsrust-analyzer cargo codespan-reporting 0.12.0 term/config/Config#chars.: Charsrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#::defaultrust-analyzer cargo codespan-reporting 0.12.0 term/config/impl#[Chars][Default]default().(), |
| 55 | start_context_linesrust-analyzer cargo codespan-reporting 0.12.0 term/config/Config#start_context_lines.: 3, |
| 56 | end_context_linesrust-analyzer cargo codespan-reporting 0.12.0 term/config/Config#end_context_lines.: 1, |
| 57 | before_label_linesrust-analyzer cargo codespan-reporting 0.12.0 term/config/Config#before_label_lines.: 0, |
| 58 | after_label_linesrust-analyzer cargo codespan-reporting 0.12.0 term/config/Config#after_label_lines.: 0, |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | /// The display style to use when rendering diagnostics. |
| 64 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 65 | pub enum DisplayStylerust-analyzer cargo codespan-reporting 0.12.0 term/config/DisplayStyle# { |
| 66 | /// Output a richly formatted diagnostic, with source code previews. |
| 67 | /// |
| 68 | /// ```text |
| 69 | /// error[E0001]: unexpected type in `+` application |
| 70 | /// ┌─ test:2:9 |
| 71 | /// │ |
| 72 | /// 2 │ (+ test "") |
| 73 | /// │ ^^ expected `Int` but found `String` |
| 74 | /// │ |
| 75 | /// = expected type `Int` |
| 76 | /// found type `String` |
| 77 | /// |
| 78 | /// error[E0002]: Bad config found |
| 79 | /// |
| 80 | /// ``` |
| 81 | Richrust-analyzer cargo codespan-reporting 0.12.0 term/config/DisplayStyle#Rich#, |
| 82 | /// Output a condensed diagnostic, with a line number, severity, message and notes (if any). |
| 83 | /// |
| 84 | /// ```text |
| 85 | /// test:2:9: error[E0001]: unexpected type in `+` application |
| 86 | /// = expected type `Int` |
| 87 | /// found type `String` |
| 88 | /// |
| 89 | /// error[E0002]: Bad config found |
| 90 | /// ``` |
| 91 | Mediumrust-analyzer cargo codespan-reporting 0.12.0 term/config/DisplayStyle#Medium#, |
| 92 | /// Output a short diagnostic, with a line number, severity, and message. |
| 93 | /// |
| 94 | /// ```text |
| 95 | /// test:2:9: error[E0001]: unexpected type in `+` application |
| 96 | /// error[E0002]: Bad config found |
| 97 | /// ``` |
| 98 | Shortrust-analyzer cargo codespan-reporting 0.12.0 term/config/DisplayStyle#Short#, |
| 99 | } |
| 100 | |
| 101 | /// Styles to use when rendering the diagnostic. |
| 102 | #[cfg(feature = "termcolor")] |
| 103 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 104 | pub struct Stylesrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles# { |
| 105 | /// The style to use when rendering bug headers. |
| 106 | /// Defaults to `fg:red bold intense`. |
| 107 | pub header_bugrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#header_bug.: ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec#, |
| 108 | /// The style to use when rendering error headers. |
| 109 | /// Defaults to `fg:red bold intense`. |
| 110 | pub header_errorrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#header_error.: ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec#, |
| 111 | /// The style to use when rendering warning headers. |
| 112 | /// Defaults to `fg:yellow bold intense`. |
| 113 | pub header_warningrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#header_warning.: ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec#, |
| 114 | /// The style to use when rendering note headers. |
| 115 | /// Defaults to `fg:green bold intense`. |
| 116 | pub header_noterust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#header_note.: ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec#, |
| 117 | /// The style to use when rendering help headers. |
| 118 | /// Defaults to `fg:cyan bold intense`. |
| 119 | pub header_helprust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#header_help.: ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec#, |
| 120 | /// The style to use when the main diagnostic message. |
| 121 | /// Defaults to `bold intense`. |
| 122 | pub header_messagerust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#header_message.: ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec#, |
| 123 | |
| 124 | /// The style to use when rendering bug labels. |
| 125 | /// Defaults to `fg:red`. |
| 126 | pub primary_label_bugrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#primary_label_bug.: ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec#, |
| 127 | /// The style to use when rendering error labels. |
| 128 | /// Defaults to `fg:red`. |
| 129 | pub primary_label_errorrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#primary_label_error.: ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec#, |
| 130 | /// The style to use when rendering warning labels. |
| 131 | /// Defaults to `fg:yellow`. |
| 132 | pub primary_label_warningrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#primary_label_warning.: ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec#, |
| 133 | /// The style to use when rendering note labels. |
| 134 | /// Defaults to `fg:green`. |
| 135 | pub primary_label_noterust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#primary_label_note.: ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec#, |
| 136 | /// The style to use when rendering help labels. |
| 137 | /// Defaults to `fg:cyan`. |
| 138 | pub primary_label_helprust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#primary_label_help.: ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec#, |
| 139 | /// The style to use when rendering secondary labels. |
| 140 | /// Defaults `fg:blue` (or `fg:cyan` on windows). |
| 141 | pub secondary_labelrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#secondary_label.: ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec#, |
| 142 | |
| 143 | /// The style to use when rendering the line numbers. |
| 144 | /// Defaults `fg:blue` (or `fg:cyan` on windows). |
| 145 | pub line_numberrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#line_number.: ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec#, |
| 146 | /// The style to use when rendering the source code borders. |
| 147 | /// Defaults `fg:blue` (or `fg:cyan` on windows). |
| 148 | pub source_borderrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#source_border.: ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec#, |
| 149 | /// The style to use when rendering the note bullets. |
| 150 | /// Defaults `fg:blue` (or `fg:cyan` on windows). |
| 151 | pub note_bulletrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#note_bullet.: ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec#, |
| 152 | } |
| 153 | |
| 154 | #[cfg(feature = "termcolor")] |
| 155 | impl Stylesrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles# { |
| 156 | /// The style used to mark a header at a given severity. |
| 157 | pub fn headerrust-analyzer cargo codespan-reporting 0.12.0 term/config/impl#[Styles]header().(&self, severity: Severityrust-analyzer cargo codespan-reporting 0.12.0 diagnostic/Severity#) -> &ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec# { |
| 158 | match severity { |
| 159 | Severityrust-analyzer cargo codespan-reporting 0.12.0 diagnostic/Severity#::Bugrust-analyzer cargo codespan-reporting 0.12.0 diagnostic/Severity#Bug# => &self.header_bugrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#header_bug., |
| 160 | Severityrust-analyzer cargo codespan-reporting 0.12.0 diagnostic/Severity#::Errorrust-analyzer cargo codespan-reporting 0.12.0 diagnostic/Severity#Error# => &self.header_errorrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#header_error., |
| 161 | Severityrust-analyzer cargo codespan-reporting 0.12.0 diagnostic/Severity#::Warningrust-analyzer cargo codespan-reporting 0.12.0 diagnostic/Severity#Warning# => &self.header_warningrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#header_warning., |
| 162 | Severityrust-analyzer cargo codespan-reporting 0.12.0 diagnostic/Severity#::Noterust-analyzer cargo codespan-reporting 0.12.0 diagnostic/Severity#Note# => &self.header_noterust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#header_note., |
| 163 | Severityrust-analyzer cargo codespan-reporting 0.12.0 diagnostic/Severity#::Helprust-analyzer cargo codespan-reporting 0.12.0 diagnostic/Severity#Help# => &self.header_helprust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#header_help., |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | /// The style used to mark a primary or secondary label at a given severity. |
| 168 | pub fn labelrust-analyzer cargo codespan-reporting 0.12.0 term/config/impl#[Styles]label().(&self, severity: Severityrust-analyzer cargo codespan-reporting 0.12.0 diagnostic/Severity#, label_style: LabelStylerust-analyzer cargo codespan-reporting 0.12.0 diagnostic/LabelStyle#) -> &ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec# { |
| 169 | match (label_style, severity) { |
| 170 | (LabelStylerust-analyzer cargo codespan-reporting 0.12.0 diagnostic/LabelStyle#::Primaryrust-analyzer cargo codespan-reporting 0.12.0 diagnostic/LabelStyle#Primary#, Severityrust-analyzer cargo codespan-reporting 0.12.0 diagnostic/Severity#::Bugrust-analyzer cargo codespan-reporting 0.12.0 diagnostic/Severity#Bug#) => &self.primary_label_bugrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#primary_label_bug., |
| 171 | (LabelStylerust-analyzer cargo codespan-reporting 0.12.0 diagnostic/LabelStyle#::Primaryrust-analyzer cargo codespan-reporting 0.12.0 diagnostic/LabelStyle#Primary#, Severityrust-analyzer cargo codespan-reporting 0.12.0 diagnostic/Severity#::Errorrust-analyzer cargo codespan-reporting 0.12.0 diagnostic/Severity#Error#) => &self.primary_label_errorrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#primary_label_error., |
| 172 | (LabelStylerust-analyzer cargo codespan-reporting 0.12.0 diagnostic/LabelStyle#::Primaryrust-analyzer cargo codespan-reporting 0.12.0 diagnostic/LabelStyle#Primary#, Severityrust-analyzer cargo codespan-reporting 0.12.0 diagnostic/Severity#::Warningrust-analyzer cargo codespan-reporting 0.12.0 diagnostic/Severity#Warning#) => &self.primary_label_warningrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#primary_label_warning., |
| 173 | (LabelStylerust-analyzer cargo codespan-reporting 0.12.0 diagnostic/LabelStyle#::Primaryrust-analyzer cargo codespan-reporting 0.12.0 diagnostic/LabelStyle#Primary#, Severityrust-analyzer cargo codespan-reporting 0.12.0 diagnostic/Severity#::Noterust-analyzer cargo codespan-reporting 0.12.0 diagnostic/Severity#Note#) => &self.primary_label_noterust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#primary_label_note., |
| 174 | (LabelStylerust-analyzer cargo codespan-reporting 0.12.0 diagnostic/LabelStyle#::Primaryrust-analyzer cargo codespan-reporting 0.12.0 diagnostic/LabelStyle#Primary#, Severityrust-analyzer cargo codespan-reporting 0.12.0 diagnostic/Severity#::Helprust-analyzer cargo codespan-reporting 0.12.0 diagnostic/Severity#Help#) => &self.primary_label_helprust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#primary_label_help., |
| 175 | (LabelStylerust-analyzer cargo codespan-reporting 0.12.0 diagnostic/LabelStyle#::Secondaryrust-analyzer cargo codespan-reporting 0.12.0 diagnostic/LabelStyle#Secondary#, _) => &self.secondary_labelrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#secondary_label., |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | #[doc(hidden)] |
| 180 | pub fn with_bluerust-analyzer cargo codespan-reporting 0.12.0 term/config/impl#[Styles]with_blue().(blue: Colorrust-analyzer cargo termcolor 1.4.1 Color#) -> Stylesrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles# { |
| 181 | let header = ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec#::newrust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec]new().().set_boldrust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec]set_bold().(true).set_intenserust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec]set_intense().(true).clonerust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec][Clone]clone().(); |
| 182 | |
| 183 | Stylesrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles# { |
| 184 | header_bugrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#header_bug.: header.clonerust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec][Clone]clone().().set_fgrust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec]set_fg().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Colorrust-analyzer cargo termcolor 1.4.1 Color#::Redrust-analyzer cargo termcolor 1.4.1 Color#Red#)).clonerust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec][Clone]clone().(), |
| 185 | header_errorrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#header_error.: header.clonerust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec][Clone]clone().().set_fgrust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec]set_fg().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Colorrust-analyzer cargo termcolor 1.4.1 Color#::Redrust-analyzer cargo termcolor 1.4.1 Color#Red#)).clonerust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec][Clone]clone().(), |
| 186 | header_warningrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#header_warning.: header.clonerust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec][Clone]clone().().set_fgrust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec]set_fg().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Colorrust-analyzer cargo termcolor 1.4.1 Color#::Yellowrust-analyzer cargo termcolor 1.4.1 Color#Yellow#)).clonerust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec][Clone]clone().(), |
| 187 | header_noterust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#header_note.: header.clonerust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec][Clone]clone().().set_fgrust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec]set_fg().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Colorrust-analyzer cargo termcolor 1.4.1 Color#::Greenrust-analyzer cargo termcolor 1.4.1 Color#Green#)).clonerust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec][Clone]clone().(), |
| 188 | header_helprust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#header_help.: header.clonerust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec][Clone]clone().().set_fgrust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec]set_fg().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Colorrust-analyzer cargo termcolor 1.4.1 Color#::Cyanrust-analyzer cargo termcolor 1.4.1 Color#Cyan#)).clonerust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec][Clone]clone().(), |
| 189 | header_messagerust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#header_message.: header, |
| 190 | |
| 191 | primary_label_bugrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#primary_label_bug.: ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec#::newrust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec]new().().set_fgrust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec]set_fg().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Colorrust-analyzer cargo termcolor 1.4.1 Color#::Redrust-analyzer cargo termcolor 1.4.1 Color#Red#)).clonerust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec][Clone]clone().(), |
| 192 | primary_label_errorrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#primary_label_error.: ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec#::newrust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec]new().().set_fgrust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec]set_fg().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Colorrust-analyzer cargo termcolor 1.4.1 Color#::Redrust-analyzer cargo termcolor 1.4.1 Color#Red#)).clonerust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec][Clone]clone().(), |
| 193 | primary_label_warningrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#primary_label_warning.: ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec#::newrust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec]new().().set_fgrust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec]set_fg().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Colorrust-analyzer cargo termcolor 1.4.1 Color#::Yellowrust-analyzer cargo termcolor 1.4.1 Color#Yellow#)).clonerust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec][Clone]clone().(), |
| 194 | primary_label_noterust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#primary_label_note.: ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec#::newrust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec]new().().set_fgrust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec]set_fg().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Colorrust-analyzer cargo termcolor 1.4.1 Color#::Greenrust-analyzer cargo termcolor 1.4.1 Color#Green#)).clonerust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec][Clone]clone().(), |
| 195 | primary_label_helprust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#primary_label_help.: ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec#::newrust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec]new().().set_fgrust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec]set_fg().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Colorrust-analyzer cargo termcolor 1.4.1 Color#::Cyanrust-analyzer cargo termcolor 1.4.1 Color#Cyan#)).clonerust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec][Clone]clone().(), |
| 196 | secondary_labelrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#secondary_label.: ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec#::newrust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec]new().().set_fgrust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec]set_fg().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(blue)).clonerust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec][Clone]clone().(), |
| 197 | |
| 198 | line_numberrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#line_number.: ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec#::newrust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec]new().().set_fgrust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec]set_fg().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(blue)).clonerust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec][Clone]clone().(), |
| 199 | source_borderrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#source_border.: ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec#::newrust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec]new().().set_fgrust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec]set_fg().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(blue)).clonerust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec][Clone]clone().(), |
| 200 | note_bulletrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles#note_bullet.: ColorSpecrust-analyzer cargo termcolor 1.4.1 ColorSpec#::newrust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec]new().().set_fgrust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec]set_fg().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(blue)).clonerust-analyzer cargo termcolor 1.4.1 impl#[ColorSpec][Clone]clone().(), |
| 201 | } |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | #[cfg(feature = "termcolor")] |
| 206 | impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for Stylesrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles# { |
| 207 | fn defaultrust-analyzer cargo codespan-reporting 0.12.0 term/config/impl#[Styles][Default]default().() -> Stylesrust-analyzer cargo codespan-reporting 0.12.0 term/config/Styles# { |
| 208 | // Blue is really difficult to see on the standard windows command line |
| 209 | #[cfg(windows)] |
| 210 | const BLUE: Colorrust-analyzer cargo termcolor 1.4.1 Color# = Colorrust-analyzer cargo termcolor 1.4.1 Color#::Cyanrust-analyzer cargo termcolor 1.4.1 Color#Cyan#; |
| 211 | #[cfg(not(windows))] |
| 212 | const BLUErust-analyzer cargo codespan-reporting 0.12.0 term/config/BLUE.: Colorrust-analyzer cargo termcolor 1.4.1 Color# = Colorrust-analyzer cargo termcolor 1.4.1 Color#::Bluerust-analyzer cargo termcolor 1.4.1 Color#Blue#; |
| 213 | |
| 214 | Selfrust-analyzer cargo codespan-reporting 0.12.0 term/config/impl#[Styles][Default]::with_bluerust-analyzer cargo codespan-reporting 0.12.0 term/config/impl#[Styles]with_blue().(BLUErust-analyzer cargo codespan-reporting 0.12.0 term/config/BLUE.) |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | /// Characters to use when rendering the diagnostic. |
| 219 | /// |
| 220 | /// By using [`Chars::ascii()`] you can switch to an ASCII-only format suitable |
| 221 | /// for rendering on terminals that do not support box drawing characters. |
| 222 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 223 | pub struct Charsrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars# { |
| 224 | /// The characters to use for the top-left border of the snippet. |
| 225 | /// Defaults to: `"┌─"` or `"-->"` with [`Chars::ascii()`]. |
| 226 | pub snippet_startrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#snippet_start.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, |
| 227 | /// The character to use for the left border of the source. |
| 228 | /// Defaults to: `'│'` or `'|'` with [`Chars::ascii()`]. |
| 229 | pub source_border_leftrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#source_border_left.: char, |
| 230 | /// The character to use for the left border break of the source. |
| 231 | /// Defaults to: `'·'` or `'.'` with [`Chars::ascii()`]. |
| 232 | pub source_border_left_breakrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#source_border_left_break.: char, |
| 233 | |
| 234 | /// The character to use for the note bullet. |
| 235 | /// Defaults to: `'='`. |
| 236 | pub note_bulletrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#note_bullet.: char, |
| 237 | |
| 238 | /// The character to use for marking a single-line primary label. |
| 239 | /// Defaults to: `'^'`. |
| 240 | pub single_primary_caretrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#single_primary_caret.: char, |
| 241 | /// The character to use for marking a single-line secondary label. |
| 242 | /// Defaults to: `'-'`. |
| 243 | pub single_secondary_caretrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#single_secondary_caret.: char, |
| 244 | |
| 245 | /// The character to use for marking the start of a multi-line primary label. |
| 246 | /// Defaults to: `'^'`. |
| 247 | pub multi_primary_caret_startrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#multi_primary_caret_start.: char, |
| 248 | /// The character to use for marking the end of a multi-line primary label. |
| 249 | /// Defaults to: `'^'`. |
| 250 | pub multi_primary_caret_endrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#multi_primary_caret_end.: char, |
| 251 | /// The character to use for marking the start of a multi-line secondary label. |
| 252 | /// Defaults to: `'\''`. |
| 253 | pub multi_secondary_caret_startrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#multi_secondary_caret_start.: char, |
| 254 | /// The character to use for marking the end of a multi-line secondary label. |
| 255 | /// Defaults to: `'\''`. |
| 256 | pub multi_secondary_caret_endrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#multi_secondary_caret_end.: char, |
| 257 | /// The character to use for the top-left corner of a multi-line label. |
| 258 | /// Defaults to: `'╭'` or `'/'` with [`Chars::ascii()`]. |
| 259 | pub multi_top_leftrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#multi_top_left.: char, |
| 260 | /// The character to use for the top of a multi-line label. |
| 261 | /// Defaults to: `'─'` or `'-'` with [`Chars::ascii()`]. |
| 262 | pub multi_toprust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#multi_top.: char, |
| 263 | /// The character to use for the bottom-left corner of a multi-line label. |
| 264 | /// Defaults to: `'╰'` or `'\'` with [`Chars::ascii()`]. |
| 265 | pub multi_bottom_leftrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#multi_bottom_left.: char, |
| 266 | /// The character to use when marking the bottom of a multi-line label. |
| 267 | /// Defaults to: `'─'` or `'-'` with [`Chars::ascii()`]. |
| 268 | pub multi_bottomrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#multi_bottom.: char, |
| 269 | /// The character to use for the left of a multi-line label. |
| 270 | /// Defaults to: `'│'` or `'|'` with [`Chars::ascii()`]. |
| 271 | pub multi_leftrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#multi_left.: char, |
| 272 | |
| 273 | /// The character to use for the left of a pointer underneath a caret. |
| 274 | /// Defaults to: `'│'` or `'|'` with [`Chars::ascii()`]. |
| 275 | pub pointer_leftrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#pointer_left.: char, |
| 276 | } |
| 277 | |
| 278 | impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for Charsrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars# { |
| 279 | fn defaultrust-analyzer cargo codespan-reporting 0.12.0 term/config/impl#[Chars][Default]default().() -> Charsrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars# { |
| 280 | Charsrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#::box_drawingrust-analyzer cargo codespan-reporting 0.12.0 term/config/impl#[Chars]box_drawing().() |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | impl Charsrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars# { |
| 285 | /// A character set that uses Unicode box drawing characters. |
| 286 | pub fn box_drawingrust-analyzer cargo codespan-reporting 0.12.0 term/config/impl#[Chars]box_drawing().() -> Charsrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars# { |
| 287 | Charsrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars# { |
| 288 | snippet_startrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#snippet_start.: "┌─".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 289 | source_border_leftrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#source_border_left.: '│', |
| 290 | source_border_left_breakrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#source_border_left_break.: '·', |
| 291 | |
| 292 | note_bulletrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#note_bullet.: '=', |
| 293 | |
| 294 | single_primary_caretrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#single_primary_caret.: '^', |
| 295 | single_secondary_caretrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#single_secondary_caret.: '-', |
| 296 | |
| 297 | multi_primary_caret_startrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#multi_primary_caret_start.: '^', |
| 298 | multi_primary_caret_endrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#multi_primary_caret_end.: '^', |
| 299 | multi_secondary_caret_startrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#multi_secondary_caret_start.: '\'', |
| 300 | multi_secondary_caret_endrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#multi_secondary_caret_end.: '\'', |
| 301 | multi_top_leftrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#multi_top_left.: '╭', |
| 302 | multi_toprust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#multi_top.: '─', |
| 303 | multi_bottom_leftrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#multi_bottom_left.: '╰', |
| 304 | multi_bottomrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#multi_bottom.: '─', |
| 305 | multi_leftrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#multi_left.: '│', |
| 306 | |
| 307 | pointer_leftrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#pointer_left.: '│', |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | /// A character set that only uses ASCII characters. |
| 312 | /// |
| 313 | /// This is useful if your terminal's font does not support box drawing |
| 314 | /// characters well and results in output that looks similar to rustc's |
| 315 | /// diagnostic output. |
| 316 | pub fn asciirust-analyzer cargo codespan-reporting 0.12.0 term/config/impl#[Chars]ascii().() -> Charsrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars# { |
| 317 | Charsrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars# { |
| 318 | snippet_startrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#snippet_start.: "-->".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 319 | source_border_leftrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#source_border_left.: '|', |
| 320 | source_border_left_breakrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#source_border_left_break.: '.', |
| 321 | |
| 322 | note_bulletrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#note_bullet.: '=', |
| 323 | |
| 324 | single_primary_caretrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#single_primary_caret.: '^', |
| 325 | single_secondary_caretrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#single_secondary_caret.: '-', |
| 326 | |
| 327 | multi_primary_caret_startrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#multi_primary_caret_start.: '^', |
| 328 | multi_primary_caret_endrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#multi_primary_caret_end.: '^', |
| 329 | multi_secondary_caret_startrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#multi_secondary_caret_start.: '\'', |
| 330 | multi_secondary_caret_endrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#multi_secondary_caret_end.: '\'', |
| 331 | multi_top_leftrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#multi_top_left.: '/', |
| 332 | multi_toprust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#multi_top.: '-', |
| 333 | multi_bottom_leftrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#multi_bottom_left.: '\\', |
| 334 | multi_bottomrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#multi_bottom.: '-', |
| 335 | multi_leftrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#multi_left.: '|', |
| 336 | |
| 337 | pointer_leftrust-analyzer cargo codespan-reporting 0.12.0 term/config/Chars#pointer_left.: '|', |
| 338 | } |
| 339 | } |
| 340 | } |