Debian Codegraph @

src/parse_style.rs

raw symbols SCIP
1 use bitflagsrust-analyzer cargo bitflags 2.13.1 crate/::bitflagsrust-analyzer cargo bitflags 2.13.1 bitflags!;
2
3 use craterust-analyzer cargo git-delta 0.19.2 crate/::colorrust-analyzer cargo git-delta 0.19.2 color/;
4 use craterust-analyzer cargo git-delta 0.19.2 crate/::configrust-analyzer cargo git-delta 0.19.2 config/::delta_unreachablerust-analyzer cargo git-delta 0.19.2 config/delta_unreachable().;
5 use craterust-analyzer cargo git-delta 0.19.2 crate/::fatalrust-analyzer cargo git-delta 0.19.2 fatal().;
6 use craterust-analyzer cargo git-delta 0.19.2 crate/::git_configrust-analyzer cargo git-delta 0.19.2 git_config/::GitConfigrust-analyzer cargo git-delta 0.19.2 git_config/GitConfig#;
7 use craterust-analyzer cargo git-delta 0.19.2 crate/::stylerust-analyzer cargo git-delta 0.19.2 style/::{DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#, Stylerust-analyzer cargo git-delta 0.19.2 style/Style#};
8
9 impl Stylerust-analyzer cargo git-delta 0.19.2 style/Style# {
10 /// Construct Style from style and decoration-style strings supplied on command line, together
11 /// with defaults. A style string is a space-separated string containing 0, 1, or 2 colors
12 /// (foreground and then background) and an arbitrary number of style attributes. See `delta
13 /// --help` for more precise spec.
14 pub fn from_strrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[Style]from_str().(
15 style_string: &str,
16 default: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[Style]>,
17 decoration_style_string: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str>,
18 true_color: bool,
19 git_config: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&GitConfigrust-analyzer cargo git-delta 0.19.2 git_config/GitConfig#>,
20 ) -> Selfrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[Style] {
21 let (ansi_term_style, is_omitted, is_raw, is_syntax_highlighted) =
22 parse_ansi_term_stylerust-analyzer cargo git-delta 0.19.2 parse_style/parse_ansi_term_style().(style_string, default, true_color, git_config);
23 let decoration_style = DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::from_strrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationStyle]from_str().(
24 decoration_style_string.unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(""),
25 true_color,
26 git_config,
27 );
28 Selfrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[Style] {
29 ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style.,
30 is_emphrust-analyzer cargo git-delta 0.19.2 style/Style#is_emph.: false,
31 is_omittedrust-analyzer cargo git-delta 0.19.2 style/Style#is_omitted.,
32 is_rawrust-analyzer cargo git-delta 0.19.2 style/Style#is_raw.,
33 is_syntax_highlightedrust-analyzer cargo git-delta 0.19.2 style/Style#is_syntax_highlighted.,
34 decoration_stylerust-analyzer cargo git-delta 0.19.2 style/Style#decoration_style.,
35 }
36 }
37
38 pub fn from_git_strrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[Style]from_git_str().(git_style_string: &str) -> Selfrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[Style] {
39 Selfrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[Style]::from_strrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[Style]from_str().(git_style_string, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, true, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#)
40 }
41
42 /// Construct Style but interpreting 'ul', 'box', etc as applying to the decoration style.
43 pub fn from_str_with_handling_of_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[Style]from_str_with_handling_of_special_decoration_attributes().(
44 style_string: &str,
45 default: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[Style]>,
46 decoration_style_string: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str>,
47 true_color: bool,
48 git_config: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&GitConfigrust-analyzer cargo git-delta 0.19.2 git_config/GitConfig#>,
49 ) -> Selfrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[Style] {
50 let (special_attributes_from_style_string, style_string) =
51 extract_special_decoration_attributes_from_non_decoration_style_stringrust-analyzer cargo git-delta 0.19.2 parse_style/extract_special_decoration_attributes_from_non_decoration_style_string().(style_string);
52 let mut style = Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::from_strrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[Style]from_str().(
53 &style_string,
54 default,
55 decoration_style_string,
56 true_color,
57 git_config,
58 );
59 // TODO: box in this context resulted in box-with-underline for commit and file
60 style.decoration_stylerust-analyzer cargo git-delta 0.19.2 style/Style#decoration_style. = DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::apply_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationStyle]apply_special_decoration_attributes().(
61 &mut style,
62 special_attributes_from_style_string,
63 );
64 style
65 }
66 }
67
68 bitflagsrust-analyzer cargo bitflags 2.13.1 bitflags!! {
69 #[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:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
70 struct DecorationAttributesrust-analyzer cargo git-delta 0.19.2 parse_style/DecorationAttributes#: u8 {
71 const EMPTYrust-analyzer cargo git-delta 0.19.2 parse_style/__bitflags_flag_names/EMPTY. = 0b00000000;
72 const BOXrust-analyzer cargo git-delta 0.19.2 parse_style/__bitflags_flag_names/BOX. = 0b00000001;
73 const OVERLINErust-analyzer cargo git-delta 0.19.2 parse_style/__bitflags_flag_names/OVERLINE. = 0b00000010;
74 const UNDERLINErust-analyzer cargo git-delta 0.19.2 parse_style/__bitflags_flag_names/UNDERLINE. = 0b00000100;
75 }
76 }
77
78 impl DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle# {
79 pub fn from_strrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationStyle]from_str().(style_string: &str, true_color: bool, git_config: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&GitConfigrust-analyzer cargo git-delta 0.19.2 git_config/GitConfig#>) -> Selfrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationStyle] {
80 let (special_attributes, style_string) =
81 extract_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_style/extract_special_decoration_attributes().(style_string);
82 let (style, is_omitted, is_raw, is_syntax_highlighted) =
83 parse_ansi_term_stylerust-analyzer cargo git-delta 0.19.2 parse_style/parse_ansi_term_style().(&style_string, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, true_color, git_config);
84 if is_raw {
85 fatalrust-analyzer cargo git-delta 0.19.2 fatal().("'raw' may not be used in a decoration style.");
86 };
87 if is_syntax_highlighted {
88 fatalrust-analyzer cargo git-delta 0.19.2 fatal().("'syntax' may not be used in a decoration style.");
89 };
90 #[allow(non_snake_case)]
91 let (BOX, UL, OL, EMPTY) = (
92 DecorationAttributesrust-analyzer cargo git-delta 0.19.2 parse_style/DecorationAttributes#::BOXrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes]BOX.,
93 DecorationAttributesrust-analyzer cargo git-delta 0.19.2 parse_style/DecorationAttributes#::UNDERLINErust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes]UNDERLINE.,
94 DecorationAttributesrust-analyzer cargo git-delta 0.19.2 parse_style/DecorationAttributes#::OVERLINErust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes]OVERLINE.,
95 DecorationAttributesrust-analyzer cargo git-delta 0.19.2 parse_style/DecorationAttributes#::EMPTYrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes]EMPTY.,
96 );
97 match special_attributes {
98 bits if bits rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().==rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().EMPTY => DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::NoDecorationrust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#NoDecoration#,
99 bits if bits rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().==rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().BOX => DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::Boxrust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#Box#(style),
100 bits if bits rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().==rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().UL => DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::Underlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#Underline#(style),
101 bits if bits rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().==rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().OL => DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::Overlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#Overline#(style),
102 bits if bits rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().==rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().UL rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor().|rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor().OL => DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::UnderOverlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#UnderOverline#(style),
103 bits if bits rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().==rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().BOX rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor().|rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor().UL => DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::BoxWithUnderlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#BoxWithUnderline#(style),
104 bits if bits rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().==rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().BOX rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor().|rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor().OL => DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::BoxWithOverlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#BoxWithOverline#(style),
105 bits if bits rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().==rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().BOX rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor().|rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor().UL rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor().|rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor().OL => DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::BoxWithUnderOverlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#BoxWithUnderOverline#(style),
106 _ if is_omitted => DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::NoDecorationrust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#NoDecoration#,
107 _ => delta_unreachablerust-analyzer cargo git-delta 0.19.2 config/delta_unreachable().("Unreachable code path reached in parse_decoration_style."),
108 }
109 }
110
111 fn apply_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationStyle]apply_special_decoration_attributes().(
112 style: &mut Stylerust-analyzer cargo git-delta 0.19.2 style/Style#,
113 special_attributes: DecorationAttributesrust-analyzer cargo git-delta 0.19.2 parse_style/DecorationAttributes#,
114 ) -> DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle# {
115 let ansi_term_style = match style.decoration_stylerust-analyzer cargo git-delta 0.19.2 style/Style#decoration_style. {
116 DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::Boxrust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#Box#(ansi_term_style) => ansi_term_style,
117 DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::Underlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#Underline#(ansi_term_style) => ansi_term_style,
118 DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::Overlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#Overline#(ansi_term_style) => ansi_term_style,
119 DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::UnderOverlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#UnderOverline#(ansi_term_style) => ansi_term_style,
120 DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::BoxWithUnderlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#BoxWithUnderline#(ansi_term_style) => ansi_term_style,
121 DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::BoxWithOverlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#BoxWithOverline#(ansi_term_style) => ansi_term_style,
122 DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::BoxWithUnderOverlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#BoxWithUnderOverline#(ansi_term_style) => ansi_term_style,
123 DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::NoDecorationrust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#NoDecoration# => ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#::newrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style]new().(),
124 };
125 #[allow(non_snake_case)]
126 let (BOX, UL, OL, EMPTY) = (
127 DecorationAttributesrust-analyzer cargo git-delta 0.19.2 parse_style/DecorationAttributes#::BOXrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes]BOX.,
128 DecorationAttributesrust-analyzer cargo git-delta 0.19.2 parse_style/DecorationAttributes#::UNDERLINErust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes]UNDERLINE.,
129 DecorationAttributesrust-analyzer cargo git-delta 0.19.2 parse_style/DecorationAttributes#::OVERLINErust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes]OVERLINE.,
130 DecorationAttributesrust-analyzer cargo git-delta 0.19.2 parse_style/DecorationAttributes#::EMPTYrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes]EMPTY.,
131 );
132 match special_attributes {
133 bits if bits rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().==rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().EMPTY => style.decoration_stylerust-analyzer cargo git-delta 0.19.2 style/Style#decoration_style.,
134 bits if bits rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().==rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().BOX => DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::Boxrust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#Box#(ansi_term_style),
135 bits if bits rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().==rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().UL => DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::Underlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#Underline#(ansi_term_style),
136 bits if bits rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().==rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().OL => DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::Overlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#Overline#(ansi_term_style),
137 bits if bits rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().==rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().UL rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor().|rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor().OL => DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::UnderOverlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#UnderOverline#(ansi_term_style),
138 bits if bits rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().==rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().BOX rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor().|rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor().UL => DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::BoxWithUnderlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#BoxWithUnderline#(ansi_term_style),
139 bits if bits rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().==rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().BOX rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor().|rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor().OL => DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::BoxWithOverlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#BoxWithOverline#(ansi_term_style),
140 bits if bits rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().==rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`PartialEq<Self>`]eq().BOX rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor().|rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor().UL rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor().|rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor().OL => DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::BoxWithUnderOverlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#BoxWithUnderOverline#(ansi_term_style),
141 _ => DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::NoDecorationrust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#NoDecoration#,
142 }
143 }
144 }
145
146 fn parse_ansi_term_stylerust-analyzer cargo git-delta 0.19.2 parse_style/parse_ansi_term_style().(
147 s: &str,
148 default: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stylerust-analyzer cargo git-delta 0.19.2 style/Style#>,
149 true_color: bool,
150 git_config: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&GitConfigrust-analyzer cargo git-delta 0.19.2 git_config/GitConfig#>,
151 ) -> (ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#, bool, bool, bool) {
152 let mut style = ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#::newrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style]new().();
153 let mut seen_foreground = false;
154 let mut seen_background = false;
155 let mut foreground_is_auto = false;
156 let mut background_is_auto = false;
157 let mut is_omitted = false;
158 let mut is_raw = false;
159 let mut seen_omit = false;
160 let mut seen_raw = false;
161 let mut is_syntax_highlighted = false;
162 for word in s
163 .to_lowercaserust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]to_lowercase().()
164 .split_whitespacerust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split_whitespace().()
165 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|word| word.trim_matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim_matches().(|c| c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'"' || c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'\''))
166 {
167 if word rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."blink" {
168 style.is_blinkrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_blink. = true;
169 } else if word rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."bold" {
170 style.is_boldrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_bold. = true;
171 } else if word rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."dim" {
172 style.is_dimmedrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_dimmed. = true;
173 } else if word rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."hidden" {
174 style.is_hiddenrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_hidden. = true;
175 } else if word rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."italic" {
176 style.is_italicrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_italic. = true;
177 } else if word rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."omit" {
178 seen_omit = true;
179 is_omitted = true;
180 } else if word rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."reverse" {
181 style.is_reverserust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_reverse. = true;
182 } else if word rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."raw" {
183 seen_raw = true;
184 is_raw = true;
185 } else if word rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."strike" {
186 style.is_strikethroughrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_strikethrough. = true;
187 } else if word rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."ul" || word rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."underline" {
188 style.is_underlinerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_underline. = true;
189 } else if word rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."line-number" || word rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."file" || word rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."omit-code-fragment" {
190 // Allow: these are meaningful in hunk-header-style.
191 } else if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().seen_foreground {
192 if word rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."syntax" {
193 is_syntax_highlighted = true;
194 } else if word rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."auto" {
195 foreground_is_auto = true;
196 style.foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground. = default.and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|s| s.ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style..foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground.);
197 is_syntax_highlighted = default.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|s| s.is_syntax_highlightedrust-analyzer cargo git-delta 0.19.2 style/Style#is_syntax_highlighted.).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(false);
198 } else {
199 style.foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground. = colorrust-analyzer cargo git-delta 0.19.2 color/::parse_colorrust-analyzer cargo git-delta 0.19.2 color/parse_color().(word, true_color, git_config);
200 }
201 seen_foreground = true;
202 } else if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().seen_background {
203 if word rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."syntax" {
204 fatalrust-analyzer cargo git-delta 0.19.2 fatal().(
205 "You have used the special color 'syntax' as a background color \
206 (second color in a style string). It may only be used as a foreground \
207 color (first color in a style string).",
208 );
209 } else if word rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."auto" {
210 background_is_auto = true;
211 style.backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background. = default.and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|s| s.ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style..backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background.);
212 } else {
213 style.backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background. = colorrust-analyzer cargo git-delta 0.19.2 color/::parse_colorrust-analyzer cargo git-delta 0.19.2 color/parse_color().(word, true_color, git_config);
214 }
215 seen_background = true;
216 } else {
217 fatalrust-analyzer cargo git-delta 0.19.2 fatal().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!(
218 "Invalid style string: {s}. See the STYLES section of delta --help.",
219 ));
220 }
221 }
222 if foreground_is_auto && background_is_auto {
223 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().seen_omit {
224 is_omitted = default.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|s| s.is_omittedrust-analyzer cargo git-delta 0.19.2 style/Style#is_omitted.).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(false);
225 }
226 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().seen_raw {
227 is_raw = default.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|s| s.is_rawrust-analyzer cargo git-delta 0.19.2 style/Style#is_raw.).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(false);
228 }
229 }
230 (style, is_omitted, is_raw, is_syntax_highlighted)
231 }
232
233 /// Extract set of 'special decoration attributes' and return it along with modified style string.
234 fn extract_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_style/extract_special_decoration_attributes().(style_string: &str) -> (DecorationAttributesrust-analyzer cargo git-delta 0.19.2 parse_style/DecorationAttributes#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) {
235 _extract_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_style/_extract_special_decoration_attributes().(style_string, true)
236 }
237
238 fn extract_special_decoration_attributes_from_non_decoration_style_stringrust-analyzer cargo git-delta 0.19.2 parse_style/extract_special_decoration_attributes_from_non_decoration_style_string().(
239 style_string: &str,
240 ) -> (DecorationAttributesrust-analyzer cargo git-delta 0.19.2 parse_style/DecorationAttributes#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) {
241 _extract_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_style/_extract_special_decoration_attributes().(style_string, false)
242 }
243
244 // If this is being called in the context of processing a decoration style string then we treat
245 // ul/ol as a request for an underline/overline decoration respectively. Otherwise they are
246 // conventional character style attributes.
247 fn _extract_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_style/_extract_special_decoration_attributes().(
248 style_string: &str,
249 is_decoration_style_string: bool,
250 ) -> (DecorationAttributesrust-analyzer cargo git-delta 0.19.2 parse_style/DecorationAttributes#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) {
251 let mut attributes = DecorationAttributesrust-analyzer cargo git-delta 0.19.2 parse_style/DecorationAttributes#::EMPTYrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes]EMPTY.;
252 let mut new_style_string = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().();
253 let style_string = style_string.to_lowercaserust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]to_lowercase().();
254 for token in style_string
255 .split_whitespacerust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split_whitespace().()
256 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|word| word.trim_matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim_matches().(|c| c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'"' || c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'\''))
257 {
258 match token {
259 "box" => attributes rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOrAssign<Self>`]bitor_assign().DecorationAttributesrust-analyzer cargo git-delta 0.19.2 parse_style/DecorationAttributes#::BOXrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes]BOX.,
260 token if token rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."overline" || is_decoration_style_string && token rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."ol" => {
261 attributes rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOrAssign<Self>`]bitor_assign().DecorationAttributesrust-analyzer cargo git-delta 0.19.2 parse_style/DecorationAttributes#::OVERLINErust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes]OVERLINE.
262 }
263 token if token rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."underline" || is_decoration_style_string && token rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."ul" => {
264 attributes rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOrAssign<Self>`]bitor_assign().DecorationAttributesrust-analyzer cargo git-delta 0.19.2 parse_style/DecorationAttributes#::UNDERLINErust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes]UNDERLINE.
265 }
266 token if token rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."none" || token rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."plain" => {}
267 _ => new_style_string.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(token),
268 }
269 }
270 (attributes, new_style_string.joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().(" "))
271 }
272
273 #[cfg(test)]
274 mod testsrust-analyzer cargo git-delta 0.19.2 parse_style/tests/ {
275 use superrust-analyzer cargo git-delta 0.19.2 parse_style/::*;
276
277 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
278 fn test_parse_ansi_term_stylerust-analyzer cargo git-delta 0.19.2 parse_style/tests/test_parse_ansi_term_style().() {
279 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
280 parse_ansi_term_stylerust-analyzer cargo git-delta 0.19.2 parse_style/parse_ansi_term_style().("", Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, false, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#),
281 (ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#::newrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style]new().(), false, false, false)
282 );
283 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
284 parse_ansi_term_stylerust-analyzer cargo git-delta 0.19.2 parse_style/parse_ansi_term_style().("red", Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, false, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#),
285 (
286 ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style# {
287 foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Redrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Red#),
288 ..ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#::newrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style]new().()
289 },
290 false,
291 false,
292 false
293 )
294 );
295 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
296 parse_ansi_term_stylerust-analyzer cargo git-delta 0.19.2 parse_style/parse_ansi_term_style().("red green", Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, false, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#),
297 (
298 ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style# {
299 foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Redrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Red#),
300 backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Greenrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Green#),
301 ..ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#::newrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style]new().()
302 },
303 false,
304 false,
305 false
306 )
307 );
308 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
309 parse_ansi_term_stylerust-analyzer cargo git-delta 0.19.2 parse_style/parse_ansi_term_style().("bold red underline green blink", Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, false, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#),
310 (
311 ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style# {
312 foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Redrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Red#),
313 backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Greenrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Green#),
314 is_blinkrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_blink.: true,
315 is_boldrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_bold.: true,
316 is_underlinerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_underline.: true,
317 ..ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#::newrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style]new().()
318 },
319 false,
320 false,
321 false
322 )
323 );
324 }
325
326 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
327 fn test_parse_ansi_term_style_with_special_syntax_colorrust-analyzer cargo git-delta 0.19.2 parse_style/tests/test_parse_ansi_term_style_with_special_syntax_color().() {
328 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
329 parse_ansi_term_stylerust-analyzer cargo git-delta 0.19.2 parse_style/parse_ansi_term_style().("syntax", Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, false, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#),
330 (ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#::newrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style]new().(), false, false, true)
331 );
332 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
333 parse_ansi_term_stylerust-analyzer cargo git-delta 0.19.2 parse_style/parse_ansi_term_style().("syntax italic white hidden", Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, false, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#),
334 (
335 ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style# {
336 backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Whiterust-analyzer cargo nu-ansi-term 0.50.3 style/Color#White#),
337 is_italicrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_italic.: true,
338 is_hiddenrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_hidden.: true,
339 ..ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#::newrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style]new().()
340 },
341 false,
342 false,
343 true
344 )
345 );
346 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
347 parse_ansi_term_stylerust-analyzer cargo git-delta 0.19.2 parse_style/parse_ansi_term_style().("bold syntax italic white hidden", Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, false, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#),
348 (
349 ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style# {
350 backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Whiterust-analyzer cargo nu-ansi-term 0.50.3 style/Color#White#),
351 is_boldrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_bold.: true,
352 is_italicrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_italic.: true,
353 is_hiddenrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_hidden.: true,
354 ..ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#::newrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style]new().()
355 },
356 false,
357 false,
358 true
359 )
360 );
361 }
362
363 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
364 fn test_parse_ansi_term_style_with_special_omit_attributerust-analyzer cargo git-delta 0.19.2 parse_style/tests/test_parse_ansi_term_style_with_special_omit_attribute().() {
365 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
366 parse_ansi_term_stylerust-analyzer cargo git-delta 0.19.2 parse_style/parse_ansi_term_style().("omit", Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, false, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#),
367 (ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#::newrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style]new().(), true, false, false)
368 );
369 // It doesn't make sense for omit to be combined with anything else, but it is not an error.
370 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
371 parse_ansi_term_stylerust-analyzer cargo git-delta 0.19.2 parse_style/parse_ansi_term_style().("omit syntax italic white hidden", Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, false, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#),
372 (
373 ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style# {
374 backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Whiterust-analyzer cargo nu-ansi-term 0.50.3 style/Color#White#),
375 is_italicrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_italic.: true,
376 is_hiddenrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_hidden.: true,
377 ..ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#::newrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style]new().()
378 },
379 true,
380 false,
381 true
382 )
383 );
384 }
385
386 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
387 fn test_parse_ansi_term_style_with_special_raw_attributerust-analyzer cargo git-delta 0.19.2 parse_style/tests/test_parse_ansi_term_style_with_special_raw_attribute().() {
388 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
389 parse_ansi_term_stylerust-analyzer cargo git-delta 0.19.2 parse_style/parse_ansi_term_style().("raw", Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, false, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#),
390 (ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#::newrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style]new().(), false, true, false)
391 );
392 // It doesn't make sense for raw to be combined with anything else, but it is not an error.
393 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
394 parse_ansi_term_stylerust-analyzer cargo git-delta 0.19.2 parse_style/parse_ansi_term_style().("raw syntax italic white hidden", Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, false, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#),
395 (
396 ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style# {
397 backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Whiterust-analyzer cargo nu-ansi-term 0.50.3 style/Color#White#),
398 is_italicrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_italic.: true,
399 is_hiddenrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_hidden.: true,
400 ..ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#::newrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style]new().()
401 },
402 false,
403 true,
404 true
405 )
406 );
407 }
408
409 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
410 fn test_extract_special_decoration_attributerust-analyzer cargo git-delta 0.19.2 parse_style/tests/test_extract_special_decoration_attribute().() {
411 #[allow(non_snake_case)]
412 let (BOX, UL, OL, EMPTY) = (
413 DecorationAttributesrust-analyzer cargo git-delta 0.19.2 parse_style/DecorationAttributes#::BOXrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes]BOX.,
414 DecorationAttributesrust-analyzer cargo git-delta 0.19.2 parse_style/DecorationAttributes#::UNDERLINErust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes]UNDERLINE.,
415 DecorationAttributesrust-analyzer cargo git-delta 0.19.2 parse_style/DecorationAttributes#::OVERLINErust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes]OVERLINE.,
416 DecorationAttributesrust-analyzer cargo git-delta 0.19.2 parse_style/DecorationAttributes#::EMPTYrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes]EMPTY.,
417 );
418 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
419 extract_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_style/extract_special_decoration_attributes().(""),
420 (EMPTY, "".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),)
421 );
422 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
423 extract_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_style/extract_special_decoration_attributes().("box"),
424 (BOX, "".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())
425 );
426 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
427 extract_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_style/extract_special_decoration_attributes().("ul"),
428 (UL, "".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())
429 );
430 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
431 extract_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_style/extract_special_decoration_attributes().("ol"),
432 (OL, "".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())
433 );
434 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
435 extract_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_style/extract_special_decoration_attributes().("box ul"),
436 (BOX |rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor(). UL, "".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())
437 );
438 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
439 extract_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_style/extract_special_decoration_attributes().("box ol"),
440 (BOX |rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor(). OL, "".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())
441 );
442 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
443 extract_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_style/extract_special_decoration_attributes().("ul box ol"),
444 (BOX |rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor(). UL |rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor(). OL, "".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())
445 );
446 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
447 extract_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_style/extract_special_decoration_attributes().("ol ul"),
448 (UL |rust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationAttributes][`BitOr<Self>`]bitor(). OL, "".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())
449 );
450 }
451
452 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
453 fn test_decoration_style_from_str_empty_stringrust-analyzer cargo git-delta 0.19.2 parse_style/tests/test_decoration_style_from_str_empty_string().() {
454 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
455 DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::from_strrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationStyle]from_str().("", true, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#),
456 DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::NoDecorationrust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#NoDecoration#,
457 )
458 }
459
460 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
461 fn test_decoration_style_from_strrust-analyzer cargo git-delta 0.19.2 parse_style/tests/test_decoration_style_from_str().() {
462 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
463 DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::from_strrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[DecorationStyle]from_str().("ol red box bold green ul", true, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#),
464 DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::BoxWithUnderOverlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#BoxWithUnderOverline#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style# {
465 foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Redrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Red#),
466 backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Greenrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Green#),
467 is_boldrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_bold.: true,
468 ..ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#::newrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style]new().()
469 })
470 )
471 }
472
473 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
474 fn test_style_from_strrust-analyzer cargo git-delta 0.19.2 parse_style/tests/test_style_from_str().() {
475 let actual_style = Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::from_strrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[Style]from_str().(
476 "red green bold",
477 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
478 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("ol red box bold green ul"),
479 true,
480 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
481 );
482 let red_green_bold = ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style# {
483 foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Redrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Red#),
484 backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Greenrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Green#),
485 is_boldrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_bold.: true,
486 ..ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#::newrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style]new().()
487 };
488 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
489 actual_style,
490 Stylerust-analyzer cargo git-delta 0.19.2 style/Style# {
491 ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style.: red_green_bold,
492 decoration_stylerust-analyzer cargo git-delta 0.19.2 style/Style#decoration_style.: DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::BoxWithUnderOverlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#BoxWithUnderOverline#(red_green_bold),
493 ..Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::newrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]new().()
494 }
495 )
496 }
497
498 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
499 fn test_style_from_str_raw_with_boxrust-analyzer cargo git-delta 0.19.2 parse_style/tests/test_style_from_str_raw_with_box().() {
500 let actual_style = Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::from_strrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[Style]from_str().("raw", Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("box"), true, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
501 let empty_ansi_term_style = ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#::newrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style]new().();
502 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
503 actual_style,
504 Stylerust-analyzer cargo git-delta 0.19.2 style/Style# {
505 ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style.: empty_ansi_term_style,
506 decoration_stylerust-analyzer cargo git-delta 0.19.2 style/Style#decoration_style.: DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::Boxrust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#Box#(empty_ansi_term_style),
507 is_rawrust-analyzer cargo git-delta 0.19.2 style/Style#is_raw.: true,
508 ..Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::newrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]new().()
509 }
510 )
511 }
512
513 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
514 fn test_style_from_str_decoration_style_onlyrust-analyzer cargo git-delta 0.19.2 parse_style/tests/test_style_from_str_decoration_style_only().() {
515 let actual_style = Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::from_strrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[Style]from_str().("", Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("ol red box bold green ul"), true, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
516 let red_green_bold = ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style# {
517 foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Redrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Red#),
518 backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Greenrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Green#),
519 is_boldrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_bold.: true,
520 ..ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#::newrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style]new().()
521 };
522 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
523 actual_style,
524 Stylerust-analyzer cargo git-delta 0.19.2 style/Style# {
525 decoration_stylerust-analyzer cargo git-delta 0.19.2 style/Style#decoration_style.: DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::BoxWithUnderOverlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#BoxWithUnderOverline#(red_green_bold),
526 ..Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::newrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]new().()
527 }
528 )
529 }
530
531 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
532 fn test_style_from_str_with_handling_of_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_style/tests/test_style_from_str_with_handling_of_special_decoration_attributes().() {
533 let actual_style = Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::from_str_with_handling_of_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[Style]from_str_with_handling_of_special_decoration_attributes().(
534 "",
535 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
536 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("ol red box bold green ul"),
537 true,
538 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
539 );
540 let expected_decoration_style = DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::BoxWithUnderOverlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#BoxWithUnderOverline#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style# {
541 foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Redrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Red#),
542 backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Greenrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Green#),
543 is_boldrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_bold.: true,
544 ..ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#::newrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style]new().()
545 });
546 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
547 actual_style,
548 Stylerust-analyzer cargo git-delta 0.19.2 style/Style# {
549 decoration_stylerust-analyzer cargo git-delta 0.19.2 style/Style#decoration_style.: expected_decoration_style,
550 ..Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::newrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]new().()
551 }
552 )
553 }
554
555 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
556 fn test_style_from_str_with_handling_of_special_decoration_attributes_raw_with_boxrust-analyzer cargo git-delta 0.19.2 parse_style/tests/test_style_from_str_with_handling_of_special_decoration_attributes_raw_with_box().() {
557 let actual_style = Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::from_str_with_handling_of_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[Style]from_str_with_handling_of_special_decoration_attributes().(
558 "raw",
559 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
560 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("box"),
561 true,
562 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
563 );
564 let empty_ansi_term_style = ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#::newrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style]new().();
565 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
566 actual_style,
567 Stylerust-analyzer cargo git-delta 0.19.2 style/Style# {
568 ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style.: empty_ansi_term_style,
569 decoration_stylerust-analyzer cargo git-delta 0.19.2 style/Style#decoration_style.: DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::Boxrust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#Box#(empty_ansi_term_style),
570 is_rawrust-analyzer cargo git-delta 0.19.2 style/Style#is_raw.: true,
571 ..Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::newrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]new().()
572 }
573 )
574 }
575 }