Debian Codegraph @

src/style.rs

raw symbols SCIP
1 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::{BitAndrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitAnd#, BitAndAssignrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitAndAssign#, BitOrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOr#, BitOrAssignrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOrAssign#, BitXorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitXor#, BitXorAssignrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitXorAssign#, Notrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/Not#};
2
3 macro_rules! auto_impl_ref_binop_traitrust-analyzer cargo colored 3.1.1 style/auto_impl_ref_binop_trait! {
4 (impl $trait_name:ident, $method:ident for $t:ty, $u:ty) => {
5 impl $trait_name<&$u> for $t {
6 type Output = <$t as $trait_name<$t>>::Output;
7
8 #[inline]
9 fn $method(self, rhs: &$u) -> Self::Output {
10 $trait_name::$method(self, *rhs)
11 }
12 }
13
14 impl $trait_name<$u> for &$t {
15 type Output = <$t as $trait_name<$t>>::Output;
16
17 #[inline]
18 fn $method(self, rhs: $u) -> Self::Output {
19 $trait_name::$method(*self, rhs)
20 }
21 }
22
23 impl $trait_name<&$u> for &$t {
24 type Output = <$t as $trait_name<$t>>::Output;
25
26 #[inline]
27 fn $method(self, rhs: &$u) -> Self::Output {
28 $trait_name::$method(*self, *rhs)
29 }
30 }
31 };
32 }
33
34 macro_rules! impl_assign_op_traitrust-analyzer cargo colored 3.1.1 style/impl_assign_op_trait! {
35 (
36 $trait:ident, $method:ident for $t:ty, $u:ty, using $used_trait:ident::$used_method:ident
37 ) => {
38 impl $trait<$u> for $t {
39 #[inline]
40 fn $method(&mut self, other: $u) {
41 *self = $used_trait::$used_method(&*self, other);
42 }
43 }
44
45 impl $trait<&$u> for $t {
46 #[inline]
47 fn $method(&mut self, other: &$u) {
48 *self = $used_trait::$used_method(&*self, other);
49 }
50 }
51 };
52 }
53
54 const CLEARVrust-analyzer cargo colored 3.1.1 style/CLEARV.: u8 = 0b0000_0000;
55 const BOLDrust-analyzer cargo colored 3.1.1 style/BOLD.: u8 = 0b0000_0001;
56 const UNDERLINErust-analyzer cargo colored 3.1.1 style/UNDERLINE.: u8 = 0b0000_0010;
57 const REVERSEDrust-analyzer cargo colored 3.1.1 style/REVERSED.: u8 = 0b0000_0100;
58 const ITALICrust-analyzer cargo colored 3.1.1 style/ITALIC.: u8 = 0b0000_1000;
59 const BLINKrust-analyzer cargo colored 3.1.1 style/BLINK.: u8 = 0b0001_0000;
60 const HIDDENrust-analyzer cargo colored 3.1.1 style/HIDDEN.: u8 = 0b0010_0000;
61 const DIMMEDrust-analyzer cargo colored 3.1.1 style/DIMMED.: u8 = 0b0100_0000;
62 const STRIKETHROUGHrust-analyzer cargo colored 3.1.1 style/STRIKETHROUGH.: u8 = 0b1000_0000;
63
64 static STYLESrust-analyzer cargo colored 3.1.1 style/STYLES.: [(u8, Stylesrust-analyzer cargo colored 3.1.1 style/Styles#); 8] = [
65 (BOLDrust-analyzer cargo colored 3.1.1 style/BOLD., Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#),
66 (DIMMEDrust-analyzer cargo colored 3.1.1 style/DIMMED., Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Dimmedrust-analyzer cargo colored 3.1.1 style/Styles#Dimmed#),
67 (UNDERLINErust-analyzer cargo colored 3.1.1 style/UNDERLINE., Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Underlinerust-analyzer cargo colored 3.1.1 style/Styles#Underline#),
68 (REVERSEDrust-analyzer cargo colored 3.1.1 style/REVERSED., Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Reversedrust-analyzer cargo colored 3.1.1 style/Styles#Reversed#),
69 (ITALICrust-analyzer cargo colored 3.1.1 style/ITALIC., Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Italicrust-analyzer cargo colored 3.1.1 style/Styles#Italic#),
70 (BLINKrust-analyzer cargo colored 3.1.1 style/BLINK., Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Blinkrust-analyzer cargo colored 3.1.1 style/Styles#Blink#),
71 (HIDDENrust-analyzer cargo colored 3.1.1 style/HIDDEN., Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Hiddenrust-analyzer cargo colored 3.1.1 style/Styles#Hidden#),
72 (STRIKETHROUGHrust-analyzer cargo colored 3.1.1 style/STRIKETHROUGH., Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Strikethroughrust-analyzer cargo colored 3.1.1 style/Styles#Strikethrough#),
73 ];
74
75 pub static CLEARrust-analyzer cargo colored 3.1.1 style/CLEAR.: Stylerust-analyzer cargo colored 3.1.1 style/Style# = Stylerust-analyzer cargo colored 3.1.1 style/Style#(CLEARVrust-analyzer cargo colored 3.1.1 style/CLEARV.);
76
77 /// A combinatorial style such as bold, italics, dimmed, etc.
78 ///
79 /// ## Creation
80 ///
81 /// `Style::default()` returns a `Style` with no style switches
82 /// activated and is the default method of creating a plain `Style`.
83 ///
84 /// ## `Style` from a set of `Styles`s / `Styles` iterator
85 ///
86 /// `Style` implements `FromIter<Styles>` which means that it is
87 /// possible to do the following:
88 ///
89 /// ```rust
90 /// # use colored::*;
91 /// let style = Style::from_iter([Styles::Bold, Styles::Italic, Styles::Strikethrough]);
92 /// for styles in [Styles::Bold, Styles::Italic, Styles::Strikethrough] {
93 /// assert!(style.contains(styles));
94 /// }
95 /// ```
96 ///
97 /// As you can see, this is a good thing to keep in mind, although for
98 /// most cases, where you're not setting styles dynamically and are
99 /// simply creating a pre-defined set of styles, using [`Default`] and
100 /// then using the builder-style methods is likely prettier.
101 ///
102 /// ```rust
103 /// # use colored::*;
104 /// let many_styles = Style::default()
105 /// .bold()
106 /// .underline()
107 /// .italic()
108 /// .blink();
109 /// ```
110 ///
111 /// ## Implementation of logical bitwise operators
112 ///
113 /// `Style` implements bitwise logical operations that operate on
114 /// the held style switches collectively. By far the most common
115 /// and useful is the bitwise 'or' operator `|` which combines two
116 /// styles, merging their combined styles into one. Example:
117 ///
118 /// ```rust
119 /// # use colored::*;
120 /// let only_bold = Style::from(Styles::Bold);
121 /// // This line is actually an example of `Styles`'s bitwise logic impls but still.
122 /// let underline_and_italic = Styles::Underline | Styles::Italic;
123 /// let all_three = only_bold | underline_and_italic;
124 ///
125 /// assert!(all_three.contains(Styles::Bold)
126 /// && all_three.contains(Styles::Underline)
127 /// && all_three.contains(Styles::Italic));
128 /// ```
129 ///
130 /// This functionality also allows for easily turning off styles
131 /// of one `Styles` using another by combining the `&` and `!`
132 /// operators.
133 ///
134 /// ```rust
135 /// # use colored::*;
136 /// let mut very_loud_style = Style::default()
137 /// .bold()
138 /// .underline()
139 /// .italic()
140 /// .strikethrough()
141 /// .hidden();
142 ///
143 /// // Oops! Some of those should not be in there!
144 /// // This Style now has all styles _except_ the two we don't want
145 /// // (hidden and strikethough).
146 /// let remove_mask =
147 /// !Style::from_iter([Styles::Hidden, Styles::Strikethrough]);
148 /// very_loud_style &= remove_mask;
149 ///
150 /// // `very_loud_style` no longer contains the undesired style
151 /// // switches...
152 /// assert!(!very_loud_style.contains(Styles::Hidden)
153 /// && !very_loud_style.contains(Styles::Strikethrough));
154 /// // ...but it retains everything else!
155 /// assert!(very_loud_style.contains(Styles::Bold));
156 /// ```
157 #[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:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
158 pub struct Stylerust-analyzer cargo colored 3.1.1 style/Style#(u8);
159
160 /// Enum containing all of the available style settings that can be
161 /// applied to a [`Styles`] and by extension, a colrized type.
162 ///
163 /// ## Implementation of bitwise logical operators
164 ///
165 /// The implementations of [`BitAnd`], [`BitOr`], [`BitXor`], and
166 /// [`Not`] are really extensions of [`Style`]'s implementations of
167 /// the same. [`BitOr`] is great for starting chains of `Styles`'s
168 /// for creating [`Style`]'s.
169 ///
170 /// ```
171 /// # use colored::*;
172 /// let my_styles =
173 /// // BitOr<Styles> for Styles (Styles | Styles) = Style
174 /// Styles::Bold | Styles::Underline
175 /// // BitOr<Styles> for Style (Style | Styles) = Style
176 /// | Styles::Italic;
177 ///
178 /// for s in [Styles::Bold, Styles::Underline, Styles::Italic] {
179 /// assert!(my_styles.contains(s));
180 /// }
181 /// ```
182 ///
183 /// [`Not`] has far fewer use cases but can still find use in
184 /// turning a `Styles` into a [`Style`] with all styles activated
185 /// except that `Styles`.
186 ///
187 /// ```
188 /// # use colored::*;
189 /// let everything_but_bold = !Styles::Bold;
190 ///
191 /// assert!(everything_but_bold.contains(Styles::Underline));
192 /// assert!(everything_but_bold.contains(Styles::Strikethrough));
193 /// assert!(!everything_but_bold.contains(Styles::Bold));
194 /// ```
195 #[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:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
196 #[allow(missing_docs)]
197 pub enum Stylesrust-analyzer cargo colored 3.1.1 style/Styles# {
198 Clearrust-analyzer cargo colored 3.1.1 style/Styles#Clear#,
199 Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#,
200 Dimmedrust-analyzer cargo colored 3.1.1 style/Styles#Dimmed#,
201 Underlinerust-analyzer cargo colored 3.1.1 style/Styles#Underline#,
202 Reversedrust-analyzer cargo colored 3.1.1 style/Styles#Reversed#,
203 Italicrust-analyzer cargo colored 3.1.1 style/Styles#Italic#,
204 Blinkrust-analyzer cargo colored 3.1.1 style/Styles#Blink#,
205 Hiddenrust-analyzer cargo colored 3.1.1 style/Styles#Hidden#,
206 Strikethroughrust-analyzer cargo colored 3.1.1 style/Styles#Strikethrough#,
207 }
208
209 impl Stylesrust-analyzer cargo colored 3.1.1 style/Styles# {
210 const fn to_strrust-analyzer cargo colored 3.1.1 style/impl#[Styles]to_str().<'a>(self) -> &'a str {
211 match self {
212 Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles]::Clearrust-analyzer cargo colored 3.1.1 style/Styles#Clear# => "", // unreachable, but we don't want to panic
213 Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles]::Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold# => "1",
214 Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles]::Dimmedrust-analyzer cargo colored 3.1.1 style/Styles#Dimmed# => "2",
215 Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles]::Italicrust-analyzer cargo colored 3.1.1 style/Styles#Italic# => "3",
216 Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles]::Underlinerust-analyzer cargo colored 3.1.1 style/Styles#Underline# => "4",
217 Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles]::Blinkrust-analyzer cargo colored 3.1.1 style/Styles#Blink# => "5",
218 Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles]::Reversedrust-analyzer cargo colored 3.1.1 style/Styles#Reversed# => "7",
219 Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles]::Hiddenrust-analyzer cargo colored 3.1.1 style/Styles#Hidden# => "8",
220 Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles]::Strikethroughrust-analyzer cargo colored 3.1.1 style/Styles#Strikethrough# => "9",
221 }
222 }
223
224 const fn to_u8rust-analyzer cargo colored 3.1.1 style/impl#[Styles]to_u8().(self) -> u8 {
225 match self {
226 Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles]::Clearrust-analyzer cargo colored 3.1.1 style/Styles#Clear# => CLEARVrust-analyzer cargo colored 3.1.1 style/CLEARV.,
227 Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles]::Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold# => BOLDrust-analyzer cargo colored 3.1.1 style/BOLD.,
228 Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles]::Dimmedrust-analyzer cargo colored 3.1.1 style/Styles#Dimmed# => DIMMEDrust-analyzer cargo colored 3.1.1 style/DIMMED.,
229 Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles]::Italicrust-analyzer cargo colored 3.1.1 style/Styles#Italic# => ITALICrust-analyzer cargo colored 3.1.1 style/ITALIC.,
230 Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles]::Underlinerust-analyzer cargo colored 3.1.1 style/Styles#Underline# => UNDERLINErust-analyzer cargo colored 3.1.1 style/UNDERLINE.,
231 Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles]::Blinkrust-analyzer cargo colored 3.1.1 style/Styles#Blink# => BLINKrust-analyzer cargo colored 3.1.1 style/BLINK.,
232 Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles]::Reversedrust-analyzer cargo colored 3.1.1 style/Styles#Reversed# => REVERSEDrust-analyzer cargo colored 3.1.1 style/REVERSED.,
233 Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles]::Hiddenrust-analyzer cargo colored 3.1.1 style/Styles#Hidden# => HIDDENrust-analyzer cargo colored 3.1.1 style/HIDDEN.,
234 Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles]::Strikethroughrust-analyzer cargo colored 3.1.1 style/Styles#Strikethrough# => STRIKETHROUGHrust-analyzer cargo colored 3.1.1 style/STRIKETHROUGH.,
235 }
236 }
237
238 fn from_u8rust-analyzer cargo colored 3.1.1 style/impl#[Styles]from_u8().(u: u8) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles]>> {
239 if u rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().CLEARVrust-analyzer cargo colored 3.1.1 style/CLEARV. {
240 return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
241 }
242
243 let res: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles]> = STYLESrust-analyzer cargo colored 3.1.1 style/STYLES.
244 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
245 .filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|&(mask, _)| 0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().(u rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<&u8>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<&u8>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<&u8>`]bitand().mask))
246 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|&(_, value)| value)
247 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
248
249 if res.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() {
250 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
251 } else {
252 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(res)
253 }
254 }
255 }
256
257 impl BitAndrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitAnd#<Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitAnd<Self>`]> for Stylesrust-analyzer cargo colored 3.1.1 style/Styles# {
258 type Outputrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitAnd<Self>`]Output# = Stylerust-analyzer cargo colored 3.1.1 style/Style#;
259
260 fn bitandrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitAnd<Self>`]bitand().(self, rhs: Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitAnd<Self>`]) -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitAnd<Self>`]::Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitAnd#Output# {
261 Stylerust-analyzer cargo colored 3.1.1 style/Style#(self.to_u8rust-analyzer cargo colored 3.1.1 style/impl#[Styles]to_u8().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().rhs.to_u8rust-analyzer cargo colored 3.1.1 style/impl#[Styles]to_u8().())
262 }
263 }
264
265 auto_impl_ref_binop_traitrust-analyzer cargo colored 3.1.1 style/auto_impl_ref_binop_trait!!(impl BitAndrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitAnd#, bitandrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitAnd<&Styles>`]bitand(). for Stylesrust-analyzer cargo colored 3.1.1 style/Styles#, Stylesrust-analyzer cargo colored 3.1.1 style/Styles#);
266
267 impl BitAndrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitAnd#<Stylerust-analyzer cargo colored 3.1.1 style/Style#> for Stylesrust-analyzer cargo colored 3.1.1 style/Styles# {
268 type Outputrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitAnd<Style>`]Output# = Stylerust-analyzer cargo colored 3.1.1 style/Style#;
269
270 fn bitandrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitAnd<Style>`]bitand().(self, rhs: Stylerust-analyzer cargo colored 3.1.1 style/Style#) -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitAnd<Style>`]::Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitAnd#Output# {
271 Stylerust-analyzer cargo colored 3.1.1 style/Style#(self.to_u8rust-analyzer cargo colored 3.1.1 style/impl#[Styles]to_u8().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().rhs.0rust-analyzer cargo colored 3.1.1 style/Style#0.)
272 }
273 }
274
275 auto_impl_ref_binop_traitrust-analyzer cargo colored 3.1.1 style/auto_impl_ref_binop_trait!!(impl BitAndrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitAnd#, bitandrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitAnd<&Style>`]bitand(). for Stylesrust-analyzer cargo colored 3.1.1 style/Styles#, Stylerust-analyzer cargo colored 3.1.1 style/Style#);
276
277 impl BitOrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOr#<Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitOr<Self>`]> for Stylesrust-analyzer cargo colored 3.1.1 style/Styles# {
278 type Outputrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitOr<Self>`]Output# = Stylerust-analyzer cargo colored 3.1.1 style/Style#;
279
280 fn bitorrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitOr<Self>`]bitor().(self, rhs: Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitOr<Self>`]) -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitOr<Self>`]::Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOr#Output# {
281 Stylerust-analyzer cargo colored 3.1.1 style/Style#(self.to_u8rust-analyzer cargo colored 3.1.1 style/impl#[Styles]to_u8().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().rhs.to_u8rust-analyzer cargo colored 3.1.1 style/impl#[Styles]to_u8().())
282 }
283 }
284
285 auto_impl_ref_binop_traitrust-analyzer cargo colored 3.1.1 style/auto_impl_ref_binop_trait!!(impl BitOrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOr#, bitorrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitOr<&Styles>`]bitor(). for Stylesrust-analyzer cargo colored 3.1.1 style/Styles#, Stylesrust-analyzer cargo colored 3.1.1 style/Styles#);
286
287 impl BitOrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOr#<Stylerust-analyzer cargo colored 3.1.1 style/Style#> for Stylesrust-analyzer cargo colored 3.1.1 style/Styles# {
288 type Outputrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitOr<Style>`]Output# = Stylerust-analyzer cargo colored 3.1.1 style/Style#;
289
290 fn bitorrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitOr<Style>`]bitor().(self, rhs: Stylerust-analyzer cargo colored 3.1.1 style/Style#) -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitOr<Style>`]::Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOr#Output# {
291 Stylerust-analyzer cargo colored 3.1.1 style/Style#(self.to_u8rust-analyzer cargo colored 3.1.1 style/impl#[Styles]to_u8().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().rhs.0rust-analyzer cargo colored 3.1.1 style/Style#0.)
292 }
293 }
294
295 auto_impl_ref_binop_traitrust-analyzer cargo colored 3.1.1 style/auto_impl_ref_binop_trait!!(impl BitOrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOr#, bitorrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitOr<&Style>`]bitor(). for Stylesrust-analyzer cargo colored 3.1.1 style/Styles#, Stylerust-analyzer cargo colored 3.1.1 style/Style#);
296
297 impl BitXorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitXor#<Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitXor<Self>`]> for Stylesrust-analyzer cargo colored 3.1.1 style/Styles# {
298 type Outputrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitXor<Self>`]Output# = Stylerust-analyzer cargo colored 3.1.1 style/Style#;
299
300 fn bitxorrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitXor<Self>`]bitxor().(self, rhs: Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitXor<Self>`]) -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitXor<Self>`]::Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitXor#Output# {
301 Stylerust-analyzer cargo colored 3.1.1 style/Style#(self.to_u8rust-analyzer cargo colored 3.1.1 style/impl#[Styles]to_u8().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitXor<Self>`]bitxor().^rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitXor<Self>`]bitxor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitXor<Self>`]bitxor().rhs.to_u8rust-analyzer cargo colored 3.1.1 style/impl#[Styles]to_u8().())
302 }
303 }
304
305 auto_impl_ref_binop_traitrust-analyzer cargo colored 3.1.1 style/auto_impl_ref_binop_trait!!(impl BitXorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitXor#, bitxorrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitXor<&Styles>`]bitxor(). for Stylesrust-analyzer cargo colored 3.1.1 style/Styles#, Stylesrust-analyzer cargo colored 3.1.1 style/Styles#);
306
307 impl BitXorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitXor#<Stylerust-analyzer cargo colored 3.1.1 style/Style#> for Stylesrust-analyzer cargo colored 3.1.1 style/Styles# {
308 type Outputrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitXor<Style>`]Output# = Stylerust-analyzer cargo colored 3.1.1 style/Style#;
309
310 fn bitxorrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitXor<Style>`]bitxor().(self, rhs: Stylerust-analyzer cargo colored 3.1.1 style/Style#) -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitXor<Style>`]::Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitXor#Output# {
311 Stylerust-analyzer cargo colored 3.1.1 style/Style#(self.to_u8rust-analyzer cargo colored 3.1.1 style/impl#[Styles]to_u8().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitXor<Self>`]bitxor().^rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitXor<Self>`]bitxor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitXor<Self>`]bitxor().rhs.0rust-analyzer cargo colored 3.1.1 style/Style#0.)
312 }
313 }
314
315 auto_impl_ref_binop_traitrust-analyzer cargo colored 3.1.1 style/auto_impl_ref_binop_trait!!(impl BitXorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitXor#, bitxorrust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitXor<&Style>`]bitxor(). for Stylesrust-analyzer cargo colored 3.1.1 style/Styles#, Stylerust-analyzer cargo colored 3.1.1 style/Style#);
316
317 impl Notrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/Not# for Stylesrust-analyzer cargo colored 3.1.1 style/Styles# {
318 type Outputrust-analyzer cargo colored 3.1.1 style/impl#[Styles][Not]Output# = Stylerust-analyzer cargo colored 3.1.1 style/Style#;
319
320 fn notrust-analyzer cargo colored 3.1.1 style/impl#[Styles][Not]not().(self) -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[Styles][Not]::Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/Not#Output# {
321 Stylerust-analyzer cargo colored 3.1.1 style/Style#(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][Not]not().self.to_u8rust-analyzer cargo colored 3.1.1 style/impl#[Styles]to_u8().())
322 }
323 }
324
325 impl Notrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/Not# for &Stylesrust-analyzer cargo colored 3.1.1 style/Styles# {
326 type Outputrust-analyzer cargo colored 3.1.1 style/impl#[`&Styles`][Not]Output# = Stylerust-analyzer cargo colored 3.1.1 style/Style#;
327
328 fn notrust-analyzer cargo colored 3.1.1 style/impl#[`&Styles`][Not]not().(self) -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[`&Styles`][Not]::Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/Not#Output# {
329 Stylerust-analyzer cargo colored 3.1.1 style/Style#(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][Not]not().self.to_u8rust-analyzer cargo colored 3.1.1 style/impl#[Styles]to_u8().())
330 }
331 }
332
333 impl Stylerust-analyzer cargo colored 3.1.1 style/Style# {
334 /// Check if the current style has one of [`Styles`](Styles) switched on.
335 ///
336 /// ```rust
337 /// # use colored::*;
338 /// let colored = "".bold().italic();
339 /// assert_eq!(colored.style.contains(Styles::Bold), true);
340 /// assert_eq!(colored.style.contains(Styles::Italic), true);
341 /// assert_eq!(colored.style.contains(Styles::Dimmed), false);
342 /// ```
343 #[must_use]
344 pub fn containsrust-analyzer cargo colored 3.1.1 style/impl#[Style]contains().(self, style: Stylesrust-analyzer cargo colored 3.1.1 style/Styles#) -> bool {
345 let s = style.to_u8rust-analyzer cargo colored 3.1.1 style/impl#[Styles]to_u8().();
346 self.0rust-analyzer cargo colored 3.1.1 style/Style#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().s rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().s
347 }
348
349 pub(craterust-analyzer cargo colored 3.1.1 crate/) fn to_strrust-analyzer cargo colored 3.1.1 style/impl#[Style]to_str().(self) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
350 let styles = Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::from_u8rust-analyzer cargo colored 3.1.1 style/impl#[Styles]from_u8().(self.0rust-analyzer cargo colored 3.1.1 style/Style#0.).unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().();
351 styles
352 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
353 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|s| s.to_strrust-analyzer cargo colored 3.1.1 style/impl#[Styles]to_str().())
354 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&str>>()
355 .joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().(";")
356 }
357
358 /// Adds the `two` style switch to this Style.
359 ///
360 /// ```rust
361 /// # use colored::*;
362 /// let cstr = "".red().bold();
363 /// let mut style = cstr.style;
364 /// style.add(Styles::Italic);
365 /// let mut cstr2 = "".blue();
366 /// cstr2.style = style;
367 ///
368 /// assert!(cstr2.style.contains(Styles::Bold));
369 /// assert!(cstr2.style.contains(Styles::Italic));
370 /// assert_eq!(cstr2.fgcolor, Some(Color::Blue));
371 /// ```
372 pub fn addrust-analyzer cargo colored 3.1.1 style/impl#[Style]add().(&mut self, two: Stylesrust-analyzer cargo colored 3.1.1 style/Styles#) {
373 self.0rust-analyzer cargo colored 3.1.1 style/Style#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOrAssign<Self>`]bitor_assign().two.to_u8rust-analyzer cargo colored 3.1.1 style/impl#[Styles]to_u8().();
374 }
375
376 /// Turns off a style switch.
377 ///
378 /// ```rust
379 /// use colored::*;
380 /// let cstr = "".red().bold().italic();
381 /// let mut style = cstr.style;
382 /// style.remove(Styles::Italic);
383 /// let mut cstr2 = "".blue();
384 /// cstr2.style = style;
385 /// assert!(cstr2.style.contains(Styles::Bold));
386 /// assert!(!cstr2.style.contains(Styles::Italic));
387 /// assert_eq!(cstr2.fgcolor, Some(Color::Blue));
388 /// ```
389 pub fn removerust-analyzer cargo colored 3.1.1 style/impl#[Style]remove().(&mut self, two: Stylesrust-analyzer cargo colored 3.1.1 style/Styles#) {
390 self.0rust-analyzer cargo colored 3.1.1 style/Style#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAndAssign<Self>`]bitand_assign().&=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAndAssign<Self>`]bitand_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAndAssign<Self>`]bitand_assign().!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][Not]not().two.to_u8rust-analyzer cargo colored 3.1.1 style/impl#[Styles]to_u8().();
391 }
392
393 /// Makes this `Style` include Bold.
394 #[must_use]
395 pub fn boldrust-analyzer cargo colored 3.1.1 style/impl#[Style]bold().(mut self) -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style] {
396 self.addrust-analyzer cargo colored 3.1.1 style/impl#[Style]add().(Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#);
397 self
398 }
399
400 /// Makes this `Style` include Dimmed.
401 #[must_use]
402 pub fn dimmedrust-analyzer cargo colored 3.1.1 style/impl#[Style]dimmed().(mut self) -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style] {
403 self.addrust-analyzer cargo colored 3.1.1 style/impl#[Style]add().(Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Dimmedrust-analyzer cargo colored 3.1.1 style/Styles#Dimmed#);
404 self
405 }
406
407 /// Makes this `Style` include Underline.
408 #[must_use]
409 pub fn underlinerust-analyzer cargo colored 3.1.1 style/impl#[Style]underline().(mut self) -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style] {
410 self.addrust-analyzer cargo colored 3.1.1 style/impl#[Style]add().(Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Underlinerust-analyzer cargo colored 3.1.1 style/Styles#Underline#);
411 self
412 }
413
414 /// Makes this `Style` include Reversed.
415 #[must_use]
416 pub fn reversedrust-analyzer cargo colored 3.1.1 style/impl#[Style]reversed().(mut self) -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style] {
417 self.addrust-analyzer cargo colored 3.1.1 style/impl#[Style]add().(Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Reversedrust-analyzer cargo colored 3.1.1 style/Styles#Reversed#);
418 self
419 }
420
421 /// Makes this `Style` include Italic.
422 #[must_use]
423 pub fn italicrust-analyzer cargo colored 3.1.1 style/impl#[Style]italic().(mut self) -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style] {
424 self.addrust-analyzer cargo colored 3.1.1 style/impl#[Style]add().(Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Italicrust-analyzer cargo colored 3.1.1 style/Styles#Italic#);
425 self
426 }
427
428 /// Makes this `Style` include Blink.
429 #[must_use]
430 pub fn blinkrust-analyzer cargo colored 3.1.1 style/impl#[Style]blink().(mut self) -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style] {
431 self.addrust-analyzer cargo colored 3.1.1 style/impl#[Style]add().(Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Blinkrust-analyzer cargo colored 3.1.1 style/Styles#Blink#);
432 self
433 }
434
435 /// Makes this `Style` include Hidden.
436 #[must_use]
437 pub fn hiddenrust-analyzer cargo colored 3.1.1 style/impl#[Style]hidden().(mut self) -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style] {
438 self.addrust-analyzer cargo colored 3.1.1 style/impl#[Style]add().(Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Hiddenrust-analyzer cargo colored 3.1.1 style/Styles#Hidden#);
439 self
440 }
441
442 /// Makes this `Style` include Strikethrough.
443 #[must_use]
444 pub fn strikethroughrust-analyzer cargo colored 3.1.1 style/impl#[Style]strikethrough().(mut self) -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style] {
445 self.addrust-analyzer cargo colored 3.1.1 style/impl#[Style]add().(Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Strikethroughrust-analyzer cargo colored 3.1.1 style/Styles#Strikethrough#);
446 self
447 }
448 }
449
450 impl BitAndrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitAnd#<Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitAnd<Self>`]> for Stylerust-analyzer cargo colored 3.1.1 style/Style# {
451 type Outputrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitAnd<Self>`]Output# = Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitAnd<Self>`];
452
453 fn bitandrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitAnd<Self>`]bitand().(self, rhs: Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitAnd<Self>`]) -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitAnd<Self>`]::Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitAnd#Output# {
454 Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitAnd<Self>`](self.0rust-analyzer cargo colored 3.1.1 style/Style#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().rhs.0rust-analyzer cargo colored 3.1.1 style/Style#0.)
455 }
456 }
457
458 auto_impl_ref_binop_traitrust-analyzer cargo colored 3.1.1 style/auto_impl_ref_binop_trait!!(impl BitAndrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitAnd#, bitandrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitAnd<&Style>`]bitand(). for Stylerust-analyzer cargo colored 3.1.1 style/Style#, Stylerust-analyzer cargo colored 3.1.1 style/Style#);
459
460 impl BitAndrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitAnd#<Stylesrust-analyzer cargo colored 3.1.1 style/Styles#> for Stylerust-analyzer cargo colored 3.1.1 style/Style# {
461 type Outputrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitAnd<Styles>`]Output# = Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitAnd<Styles>`];
462
463 fn bitandrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitAnd<Styles>`]bitand().(self, rhs: Stylesrust-analyzer cargo colored 3.1.1 style/Styles#) -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitAnd<Styles>`]::Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitAnd#Output# {
464 Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitAnd<Styles>`](self.0rust-analyzer cargo colored 3.1.1 style/Style#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().rhs.to_u8rust-analyzer cargo colored 3.1.1 style/impl#[Styles]to_u8().())
465 }
466 }
467
468 auto_impl_ref_binop_traitrust-analyzer cargo colored 3.1.1 style/auto_impl_ref_binop_trait!!(impl BitAndrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitAnd#, bitandrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitAnd<&Styles>`]bitand(). for Stylerust-analyzer cargo colored 3.1.1 style/Style#, Stylesrust-analyzer cargo colored 3.1.1 style/Styles#);
469
470 impl BitOrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOr#<Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitOr<Self>`]> for Stylerust-analyzer cargo colored 3.1.1 style/Style# {
471 type Outputrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitOr<Self>`]Output# = Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitOr<Self>`];
472
473 fn bitorrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitOr<Self>`]bitor().(self, rhs: Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitOr<Self>`]) -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitOr<Self>`]::Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOr#Output# {
474 Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitOr<Self>`](self.0rust-analyzer cargo colored 3.1.1 style/Style#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().rhs.0rust-analyzer cargo colored 3.1.1 style/Style#0.)
475 }
476 }
477
478 auto_impl_ref_binop_traitrust-analyzer cargo colored 3.1.1 style/auto_impl_ref_binop_trait!!(impl BitOrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOr#, bitorrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitOr<&Style>`]bitor(). for Stylerust-analyzer cargo colored 3.1.1 style/Style#, Stylerust-analyzer cargo colored 3.1.1 style/Style#);
479
480 impl BitOrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOr#<Stylesrust-analyzer cargo colored 3.1.1 style/Styles#> for Stylerust-analyzer cargo colored 3.1.1 style/Style# {
481 type Outputrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitOr<Styles>`]Output# = Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitOr<Styles>`];
482
483 fn bitorrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitOr<Styles>`]bitor().(self, rhs: Stylesrust-analyzer cargo colored 3.1.1 style/Styles#) -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitOr<Styles>`]::Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOr#Output# {
484 Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitOr<Styles>`](self.0rust-analyzer cargo colored 3.1.1 style/Style#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().rhs.to_u8rust-analyzer cargo colored 3.1.1 style/impl#[Styles]to_u8().())
485 }
486 }
487
488 auto_impl_ref_binop_traitrust-analyzer cargo colored 3.1.1 style/auto_impl_ref_binop_trait!!(impl BitOrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOr#, bitorrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitOr<&Styles>`]bitor(). for Stylerust-analyzer cargo colored 3.1.1 style/Style#, Stylesrust-analyzer cargo colored 3.1.1 style/Styles#);
489
490 impl BitXorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitXor#<Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitXor<Self>`]> for Stylerust-analyzer cargo colored 3.1.1 style/Style# {
491 type Outputrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitXor<Self>`]Output# = Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitXor<Self>`];
492
493 fn bitxorrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitXor<Self>`]bitxor().(self, rhs: Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitXor<Self>`]) -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitXor<Self>`]::Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitXor#Output# {
494 Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitXor<Self>`](self.0rust-analyzer cargo colored 3.1.1 style/Style#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitXor<Self>`]bitxor().^rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitXor<Self>`]bitxor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitXor<Self>`]bitxor().rhs.0rust-analyzer cargo colored 3.1.1 style/Style#0.)
495 }
496 }
497
498 auto_impl_ref_binop_traitrust-analyzer cargo colored 3.1.1 style/auto_impl_ref_binop_trait!!(impl BitXorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitXor#, bitxorrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitXor<&Style>`]bitxor(). for Stylerust-analyzer cargo colored 3.1.1 style/Style#, Stylerust-analyzer cargo colored 3.1.1 style/Style#);
499
500 impl BitXorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitXor#<Stylesrust-analyzer cargo colored 3.1.1 style/Styles#> for Stylerust-analyzer cargo colored 3.1.1 style/Style# {
501 type Outputrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitXor<Styles>`]Output# = Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitXor<Styles>`];
502
503 fn bitxorrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitXor<Styles>`]bitxor().(self, rhs: Stylesrust-analyzer cargo colored 3.1.1 style/Styles#) -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitXor<Styles>`]::Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitXor#Output# {
504 Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitXor<Styles>`](self.0rust-analyzer cargo colored 3.1.1 style/Style#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitXor<Self>`]bitxor().^rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitXor<Self>`]bitxor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitXor<Self>`]bitxor().rhs.to_u8rust-analyzer cargo colored 3.1.1 style/impl#[Styles]to_u8().())
505 }
506 }
507
508 auto_impl_ref_binop_traitrust-analyzer cargo colored 3.1.1 style/auto_impl_ref_binop_trait!!(impl BitXorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitXor#, bitxorrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitXor<&Styles>`]bitxor(). for Stylerust-analyzer cargo colored 3.1.1 style/Style#, Stylesrust-analyzer cargo colored 3.1.1 style/Styles#);
509
510 impl Notrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/Not# for Stylerust-analyzer cargo colored 3.1.1 style/Style# {
511 type Outputrust-analyzer cargo colored 3.1.1 style/impl#[Style][Not]Output# = Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][Not];
512
513 fn notrust-analyzer cargo colored 3.1.1 style/impl#[Style][Not]not().(self) -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][Not]::Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/Not#Output# {
514 Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][Not](!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][Not]not().self.0rust-analyzer cargo colored 3.1.1 style/Style#0.)
515 }
516 }
517
518 impl Notrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/Not# for &Stylerust-analyzer cargo colored 3.1.1 style/Style# {
519 type Outputrust-analyzer cargo colored 3.1.1 style/impl#[`&Style`][Not]Output# = Stylerust-analyzer cargo colored 3.1.1 style/Style#;
520
521 fn notrust-analyzer cargo colored 3.1.1 style/impl#[`&Style`][Not]not().(self) -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[`&Style`][Not]::Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/Not#Output# {
522 Stylerust-analyzer cargo colored 3.1.1 style/Style#(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][Not]not().self.0rust-analyzer cargo colored 3.1.1 style/Style#0.)
523 }
524 }
525
526 impl_assign_op_traitrust-analyzer cargo colored 3.1.1 style/impl_assign_op_trait!!(BitAndAssignrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitAndAssign#, bitand_assignrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitAndAssign<Self>`]bitand_assign(). for Stylerust-analyzer cargo colored 3.1.1 style/Style#, Stylerust-analyzer cargo colored 3.1.1 style/Style#, using BitAndrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitAnd#::bitandrust-analyzer cargo colored 3.1.1 style/impl#[`&Style`][`BitAnd<Style>`]bitand().);
527
528 impl_assign_op_traitrust-analyzer cargo colored 3.1.1 style/impl_assign_op_trait!!(BitAndAssignrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitAndAssign#, bitand_assignrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitAndAssign<Styles>`]bitand_assign(). for Stylerust-analyzer cargo colored 3.1.1 style/Style#, Stylesrust-analyzer cargo colored 3.1.1 style/Styles#, using BitAndrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitAnd#::bitandrust-analyzer cargo colored 3.1.1 style/impl#[`&Style`][`BitAnd<Styles>`]bitand().);
529
530 impl_assign_op_traitrust-analyzer cargo colored 3.1.1 style/impl_assign_op_trait!!(BitOrAssignrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOrAssign#, bitor_assignrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitOrAssign<Self>`]bitor_assign(). for Stylerust-analyzer cargo colored 3.1.1 style/Style#, Stylerust-analyzer cargo colored 3.1.1 style/Style#, using BitOrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOr#::bitorrust-analyzer cargo colored 3.1.1 style/impl#[`&Style`][`BitOr<Style>`]bitor().);
531
532 impl_assign_op_traitrust-analyzer cargo colored 3.1.1 style/impl_assign_op_trait!!(BitOrAssignrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOrAssign#, bitor_assignrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitOrAssign<Styles>`]bitor_assign(). for Stylerust-analyzer cargo colored 3.1.1 style/Style#, Stylesrust-analyzer cargo colored 3.1.1 style/Styles#, using BitOrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOr#::bitorrust-analyzer cargo colored 3.1.1 style/impl#[`&Style`][`BitOr<Styles>`]bitor().);
533
534 impl_assign_op_traitrust-analyzer cargo colored 3.1.1 style/impl_assign_op_trait!!(BitXorAssignrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitXorAssign#, bitxor_assignrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitXorAssign<Self>`]bitxor_assign(). for Stylerust-analyzer cargo colored 3.1.1 style/Style#, Stylerust-analyzer cargo colored 3.1.1 style/Style#, using BitXorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitXor#::bitxorrust-analyzer cargo colored 3.1.1 style/impl#[`&Style`][`BitXor<Style>`]bitxor().);
535
536 impl_assign_op_traitrust-analyzer cargo colored 3.1.1 style/impl_assign_op_trait!!(BitXorAssignrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitXorAssign#, bitxor_assignrust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitXorAssign<Styles>`]bitxor_assign(). for Stylerust-analyzer cargo colored 3.1.1 style/Style#, Stylesrust-analyzer cargo colored 3.1.1 style/Styles#, using BitXorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitXor#::bitxorrust-analyzer cargo colored 3.1.1 style/impl#[`&Style`][`BitXor<Styles>`]bitxor().);
537
538 impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for Stylerust-analyzer cargo colored 3.1.1 style/Style# {
539 fn defaultrust-analyzer cargo colored 3.1.1 style/impl#[Style][Default]default().() -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][Default] {
540 CLEARrust-analyzer cargo colored 3.1.1 style/CLEAR.
541 }
542 }
543
544 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Stylesrust-analyzer cargo colored 3.1.1 style/Styles#> for Stylerust-analyzer cargo colored 3.1.1 style/Style# {
545 fn fromrust-analyzer cargo colored 3.1.1 style/impl#[Style][`From<Styles>`]from().(value: Stylesrust-analyzer cargo colored 3.1.1 style/Styles#) -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`From<Styles>`] {
546 Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`From<Styles>`](value.to_u8rust-analyzer cargo colored 3.1.1 style/impl#[Styles]to_u8().())
547 }
548 }
549
550 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<&Stylesrust-analyzer cargo colored 3.1.1 style/Styles#> for Stylerust-analyzer cargo colored 3.1.1 style/Style# {
551 fn fromrust-analyzer cargo colored 3.1.1 style/impl#[Style][`From<&Styles>`]from().(value: &Stylesrust-analyzer cargo colored 3.1.1 style/Styles#) -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`From<&Styles>`] {
552 Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`From<&Styles>`](value.to_u8rust-analyzer cargo colored 3.1.1 style/impl#[Styles]to_u8().())
553 }
554 }
555
556 impl FromIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/FromIterator#<Stylesrust-analyzer cargo colored 3.1.1 style/Styles#> for Stylerust-analyzer cargo colored 3.1.1 style/Style# {
557 fn from_iterrust-analyzer cargo colored 3.1.1 style/impl#[Style][`FromIterator<Styles>`]from_iter().<T: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#Item# = Stylesrust-analyzer cargo colored 3.1.1 style/Styles#>>(iter: T) -> Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`FromIterator<Styles>`] {
558 let mut style = Selfrust-analyzer cargo colored 3.1.1 style/impl#[Style][`FromIterator<Styles>`]::defaultrust-analyzer cargo colored 3.1.1 style/impl#[Style][Default]default().();
559 for styles in iter {
560 style.addrust-analyzer cargo colored 3.1.1 style/impl#[Style]add().(styles);
561 }
562 style
563 }
564 }
565
566 #[cfg(test)]
567 mod testsrust-analyzer cargo colored 3.1.1 style/tests/ {
568 use superrust-analyzer cargo colored 3.1.1 style/::*;
569
570 mod u8_to_styles_invalid_is_nonerust-analyzer cargo colored 3.1.1 style/tests/u8_to_styles_invalid_is_none/ {
571 use superrust-analyzer cargo colored 3.1.1 style/tests/::superrust-analyzer cargo colored 3.1.1 style/::Stylesrust-analyzer cargo colored 3.1.1 style/Styles#;
572 use superrust-analyzer cargo colored 3.1.1 style/tests/::superrust-analyzer cargo colored 3.1.1 style/::CLEARVrust-analyzer cargo colored 3.1.1 style/CLEARV.;
573
574 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
575 fn empty_is_nonerust-analyzer cargo colored 3.1.1 style/tests/u8_to_styles_invalid_is_none/empty_is_none().() {
576 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::from_u8rust-analyzer cargo colored 3.1.1 style/impl#[Styles]from_u8().(CLEARVrust-analyzer cargo colored 3.1.1 style/CLEARV.));
577 }
578 }
579
580 mod u8_to_styles_isomorphismrust-analyzer cargo colored 3.1.1 style/tests/u8_to_styles_isomorphism/ {
581 use superrust-analyzer cargo colored 3.1.1 style/tests/::superrust-analyzer cargo colored 3.1.1 style/::Stylesrust-analyzer cargo colored 3.1.1 style/Styles#;
582 use superrust-analyzer cargo colored 3.1.1 style/tests/::superrust-analyzer cargo colored 3.1.1 style/::{
583 BLINKrust-analyzer cargo colored 3.1.1 style/BLINK., BOLDrust-analyzer cargo colored 3.1.1 style/BOLD., DIMMEDrust-analyzer cargo colored 3.1.1 style/DIMMED., HIDDENrust-analyzer cargo colored 3.1.1 style/HIDDEN., ITALICrust-analyzer cargo colored 3.1.1 style/ITALIC., REVERSEDrust-analyzer cargo colored 3.1.1 style/REVERSED., STRIKETHROUGHrust-analyzer cargo colored 3.1.1 style/STRIKETHROUGH., UNDERLINErust-analyzer cargo colored 3.1.1 style/UNDERLINE.,
584 };
585
586 macro_rules! value_isomorphrust-analyzer cargo colored 3.1.1 style/tests/u8_to_styles_isomorphism/value_isomorph! {
587 ($name:ident, $value:expr) => {
588 #[test]
589 fn $name() {
590 let u = Styles::from_u8($value);
591 assert!(
592 u.is_some(),
593 "{}: Styles::from_u8 -> None",
594 stringify!($value)
595 );
596 let u = u.unwrap();
597 assert!(
598 u.len() == 1,
599 "{}: Styles::from_u8 found {} styles (expected 1)",
600 stringify!($value),
601 u.len()
602 );
603 assert!(
604 u[0].to_u8() == $value,
605 "{}: to_u8() doesn't match its const value",
606 stringify!($value)
607 );
608 }
609 };
610 }
611
612 value_isomorphrust-analyzer cargo colored 3.1.1 style/tests/u8_to_styles_isomorphism/value_isomorph!!(boldrust-analyzer cargo colored 3.1.1 style/tests/u8_to_styles_isomorphism/bold()., BOLDrust-analyzer cargo colored 3.1.1 style/BOLD.);
613 value_isomorphrust-analyzer cargo colored 3.1.1 style/tests/u8_to_styles_isomorphism/value_isomorph!!(underlinerust-analyzer cargo colored 3.1.1 style/tests/u8_to_styles_isomorphism/underline()., UNDERLINErust-analyzer cargo colored 3.1.1 style/UNDERLINE.);
614 value_isomorphrust-analyzer cargo colored 3.1.1 style/tests/u8_to_styles_isomorphism/value_isomorph!!(reversedrust-analyzer cargo colored 3.1.1 style/tests/u8_to_styles_isomorphism/reversed()., REVERSEDrust-analyzer cargo colored 3.1.1 style/REVERSED.);
615 value_isomorphrust-analyzer cargo colored 3.1.1 style/tests/u8_to_styles_isomorphism/value_isomorph!!(italicrust-analyzer cargo colored 3.1.1 style/tests/u8_to_styles_isomorphism/italic()., ITALICrust-analyzer cargo colored 3.1.1 style/ITALIC.);
616 value_isomorphrust-analyzer cargo colored 3.1.1 style/tests/u8_to_styles_isomorphism/value_isomorph!!(blinkrust-analyzer cargo colored 3.1.1 style/tests/u8_to_styles_isomorphism/blink()., BLINKrust-analyzer cargo colored 3.1.1 style/BLINK.);
617 value_isomorphrust-analyzer cargo colored 3.1.1 style/tests/u8_to_styles_isomorphism/value_isomorph!!(hiddenrust-analyzer cargo colored 3.1.1 style/tests/u8_to_styles_isomorphism/hidden()., HIDDENrust-analyzer cargo colored 3.1.1 style/HIDDEN.);
618 value_isomorphrust-analyzer cargo colored 3.1.1 style/tests/u8_to_styles_isomorphism/value_isomorph!!(dimmedrust-analyzer cargo colored 3.1.1 style/tests/u8_to_styles_isomorphism/dimmed()., DIMMEDrust-analyzer cargo colored 3.1.1 style/DIMMED.);
619 value_isomorphrust-analyzer cargo colored 3.1.1 style/tests/u8_to_styles_isomorphism/value_isomorph!!(strikethroughrust-analyzer cargo colored 3.1.1 style/tests/u8_to_styles_isomorphism/strikethrough()., STRIKETHROUGHrust-analyzer cargo colored 3.1.1 style/STRIKETHROUGH.);
620 }
621
622 mod styles_combine_complexrust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/ {
623 use superrust-analyzer cargo colored 3.1.1 style/tests/::superrust-analyzer cargo colored 3.1.1 style/::Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::*;
624 use superrust-analyzer cargo colored 3.1.1 style/tests/::superrust-analyzer cargo colored 3.1.1 style/::{Stylerust-analyzer cargo colored 3.1.1 style/Style#, Stylesrust-analyzer cargo colored 3.1.1 style/Styles#};
625
626 fn style_from_multiplesrust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/style_from_multiples().(styles: &[Stylesrust-analyzer cargo colored 3.1.1 style/Styles#]) -> Stylerust-analyzer cargo colored 3.1.1 style/Style# {
627 let mut res = Stylerust-analyzer cargo colored 3.1.1 style/Style#(styles[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..to_u8rust-analyzer cargo colored 3.1.1 style/impl#[Styles]to_u8().());
628 for s in &styles[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). {
629 res = Stylerust-analyzer cargo colored 3.1.1 style/Style#(res.0rust-analyzer cargo colored 3.1.1 style/Style#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().s.to_u8rust-analyzer cargo colored 3.1.1 style/impl#[Styles]to_u8().());
630 }
631 res
632 }
633
634 macro_rules! test_aggregrust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/test_aggreg! {
635 ($styles:expr, $expect:expr) => {{
636 let v = style_from_multiples($styles);
637 let r = Styles::from_u8(v.0).expect("should find styles");
638 assert_eq!(&$expect as &[Styles], &r[..])
639 }};
640 }
641
642 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
643 fn aggreg1rust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/aggreg1().() {
644 let styles: &[Stylesrust-analyzer cargo colored 3.1.1 style/Styles#] = &[Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#, Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#, Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#];
645 test_aggregrust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/test_aggreg!!(styles, [Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#]);
646 }
647
648 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
649 fn aggreg2rust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/aggreg2().() {
650 let styles: &[Stylesrust-analyzer cargo colored 3.1.1 style/Styles#] = &[Italicrust-analyzer cargo colored 3.1.1 style/Styles#Italic#, Italicrust-analyzer cargo colored 3.1.1 style/Styles#Italic#, Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#, Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#];
651 test_aggregrust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/test_aggreg!!(styles, [Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#, Italicrust-analyzer cargo colored 3.1.1 style/Styles#Italic#]);
652 }
653
654 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
655 fn aggreg3rust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/aggreg3().() {
656 let styles: &[Stylesrust-analyzer cargo colored 3.1.1 style/Styles#] = &[Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#, Italicrust-analyzer cargo colored 3.1.1 style/Styles#Italic#, Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#];
657 test_aggregrust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/test_aggreg!!(styles, [Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#, Italicrust-analyzer cargo colored 3.1.1 style/Styles#Italic#]);
658 }
659
660 macro_rules! test_combinerust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/test_combine! {
661 ($styles:expr) => {{
662 let v = style_from_multiples($styles);
663 let r = Styles::from_u8(v.0).expect("should find styles");
664 assert_eq!($styles, &r[..])
665 }};
666 }
667
668 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
669 fn two1rust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/two1().() {
670 let s: &[Stylesrust-analyzer cargo colored 3.1.1 style/Styles#] = &[Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#, Underlinerust-analyzer cargo colored 3.1.1 style/Styles#Underline#];
671 test_combinerust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/test_combine!!(s);
672 }
673
674 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
675 fn two2rust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/two2().() {
676 let s: &[Stylesrust-analyzer cargo colored 3.1.1 style/Styles#] = &[Underlinerust-analyzer cargo colored 3.1.1 style/Styles#Underline#, Italicrust-analyzer cargo colored 3.1.1 style/Styles#Italic#];
677 test_combinerust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/test_combine!!(s);
678 }
679
680 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
681 fn two3rust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/two3().() {
682 let s: &[Stylesrust-analyzer cargo colored 3.1.1 style/Styles#] = &[Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#, Italicrust-analyzer cargo colored 3.1.1 style/Styles#Italic#];
683 test_combinerust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/test_combine!!(s);
684 }
685
686 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
687 fn three1rust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/three1().() {
688 let s: &[Stylesrust-analyzer cargo colored 3.1.1 style/Styles#] = &[Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#, Underlinerust-analyzer cargo colored 3.1.1 style/Styles#Underline#, Italicrust-analyzer cargo colored 3.1.1 style/Styles#Italic#];
689 test_combinerust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/test_combine!!(s);
690 }
691
692 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
693 fn three2rust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/three2().() {
694 let s: &[Stylesrust-analyzer cargo colored 3.1.1 style/Styles#] = &[Dimmedrust-analyzer cargo colored 3.1.1 style/Styles#Dimmed#, Underlinerust-analyzer cargo colored 3.1.1 style/Styles#Underline#, Italicrust-analyzer cargo colored 3.1.1 style/Styles#Italic#];
695 test_combinerust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/test_combine!!(s);
696 }
697
698 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
699 fn fourrust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/four().() {
700 let s: &[Stylesrust-analyzer cargo colored 3.1.1 style/Styles#] = &[Dimmedrust-analyzer cargo colored 3.1.1 style/Styles#Dimmed#, Underlinerust-analyzer cargo colored 3.1.1 style/Styles#Underline#, Italicrust-analyzer cargo colored 3.1.1 style/Styles#Italic#, Hiddenrust-analyzer cargo colored 3.1.1 style/Styles#Hidden#];
701 test_combinerust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/test_combine!!(s);
702 }
703
704 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
705 fn fiverust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/five().() {
706 let s: &[Stylesrust-analyzer cargo colored 3.1.1 style/Styles#] = &[Dimmedrust-analyzer cargo colored 3.1.1 style/Styles#Dimmed#, Underlinerust-analyzer cargo colored 3.1.1 style/Styles#Underline#, Italicrust-analyzer cargo colored 3.1.1 style/Styles#Italic#, Blinkrust-analyzer cargo colored 3.1.1 style/Styles#Blink#, Hiddenrust-analyzer cargo colored 3.1.1 style/Styles#Hidden#];
707 test_combinerust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/test_combine!!(s);
708 }
709
710 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
711 fn sixrust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/six().() {
712 let s: &[Stylesrust-analyzer cargo colored 3.1.1 style/Styles#] = &[Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#, Dimmedrust-analyzer cargo colored 3.1.1 style/Styles#Dimmed#, Underlinerust-analyzer cargo colored 3.1.1 style/Styles#Underline#, Italicrust-analyzer cargo colored 3.1.1 style/Styles#Italic#, Blinkrust-analyzer cargo colored 3.1.1 style/Styles#Blink#, Hiddenrust-analyzer cargo colored 3.1.1 style/Styles#Hidden#];
713 test_combinerust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/test_combine!!(s);
714 }
715
716 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
717 fn allrust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/all().() {
718 let s: &[Stylesrust-analyzer cargo colored 3.1.1 style/Styles#] = &[
719 Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#,
720 Dimmedrust-analyzer cargo colored 3.1.1 style/Styles#Dimmed#,
721 Underlinerust-analyzer cargo colored 3.1.1 style/Styles#Underline#,
722 Reversedrust-analyzer cargo colored 3.1.1 style/Styles#Reversed#,
723 Italicrust-analyzer cargo colored 3.1.1 style/Styles#Italic#,
724 Blinkrust-analyzer cargo colored 3.1.1 style/Styles#Blink#,
725 Hiddenrust-analyzer cargo colored 3.1.1 style/Styles#Hidden#,
726 Strikethroughrust-analyzer cargo colored 3.1.1 style/Styles#Strikethrough#,
727 ];
728 test_combinerust-analyzer cargo colored 3.1.1 style/tests/styles_combine_complex/test_combine!!(s);
729 }
730 }
731
732 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
733 fn test_style_containsrust-analyzer cargo colored 3.1.1 style/tests/test_style_contains().() {
734 let mut style = Stylerust-analyzer cargo colored 3.1.1 style/Style#(Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#.to_u8rust-analyzer cargo colored 3.1.1 style/impl#[Styles]to_u8().());
735 style.addrust-analyzer cargo colored 3.1.1 style/impl#[Style]add().(Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Italicrust-analyzer cargo colored 3.1.1 style/Styles#Italic#);
736
737 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(style.containsrust-analyzer cargo colored 3.1.1 style/impl#[Style]contains().(Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#));
738 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(style.containsrust-analyzer cargo colored 3.1.1 style/impl#[Style]contains().(Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Italicrust-analyzer cargo colored 3.1.1 style/Styles#Italic#));
739 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().style.containsrust-analyzer cargo colored 3.1.1 style/impl#[Style]contains().(Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Dimmedrust-analyzer cargo colored 3.1.1 style/Styles#Dimmed#));
740 }
741
742 mod style_bitwise_logicrust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/ {
743 use superrust-analyzer cargo colored 3.1.1 style/tests/::*;
744
745 macro_rules! check_implrust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/check_impl! {
746 ($lh:expr, $method:path, $rh:expr => $res:expr) => {
747 assert_eq!($method($lh, $rh), $res);
748 assert_eq!($method(&$lh, $rh), $res);
749 assert_eq!($method($lh, &$rh), $res);
750 assert_eq!($method(&$lh, &$rh), $res);
751 };
752 }
753
754 macro_rules! check_impl_reflexiverust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/check_impl_reflexive! {
755 ($lh:expr, $method:path, $rh:expr => $res:expr) => {
756 check_impl!($lh, $method, $rh => $res);
757 check_impl!($rh, $method, $lh => $res);
758 }
759 }
760
761 /// TTABLE = `TRUTH_TABLE`
762 const TTABLErust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/TTABLE.: (u8, u8) = (0b0101, 0b0011);
763
764 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
765 fn binopsrust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/binops().() {
766 let tstyle_l = Stylerust-analyzer cargo colored 3.1.1 style/Style#(TTABLErust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/TTABLE..0);
767 let tstyle_r = Stylerust-analyzer cargo colored 3.1.1 style/Style#(TTABLErust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/TTABLE..1);
768 let and_res = Stylerust-analyzer cargo colored 3.1.1 style/Style#(TTABLErust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/TTABLE..0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().TTABLErust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/TTABLE..1);
769 let or_res = Stylerust-analyzer cargo colored 3.1.1 style/Style#(TTABLErust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/TTABLE..0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().TTABLErust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/TTABLE..1);
770 let xor_res = Stylerust-analyzer cargo colored 3.1.1 style/Style#(TTABLErust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/TTABLE..0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitXor<Self>`]bitxor().^rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitXor<Self>`]bitxor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitXor<Self>`]bitxor().TTABLErust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/TTABLE..1);
771
772 check_implrust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/check_impl!!(tstyle_l, BitAndrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitAnd#::bitandrust-analyzer cargo colored 3.1.1 style/impl#[`&Style`][`BitAnd<Self>`]bitand()., tstyle_r => and_res);
773 check_implrust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/check_impl!!(tstyle_l, BitOrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOr#::bitorrust-analyzer cargo colored 3.1.1 style/impl#[`&Style`][`BitOr<Self>`]bitor()., tstyle_r => or_res);
774 check_implrust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/check_impl!!(tstyle_l, BitXorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitXor#::bitxorrust-analyzer cargo colored 3.1.1 style/impl#[`&Style`][`BitXor<Self>`]bitxor()., tstyle_r => xor_res);
775 }
776
777 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
778 fn binops_with_stylesrust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/binops_with_styles().() {
779 let bold_underline = Stylerust-analyzer cargo colored 3.1.1 style/Style#(0b0011);
780
781 check_impl_reflexiverust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/check_impl_reflexive!!(
782 bold_underline,
783 BitAndrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitAnd#::bitandrust-analyzer cargo colored 3.1.1 style/impl#[`&Styles`][`BitAnd<&Style>`]bitand().,
784 Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#
785 => Stylerust-analyzer cargo colored 3.1.1 style/Style#(0b0000_0001)
786 );
787 check_impl_reflexiverust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/check_impl_reflexive!!(
788 bold_underline,
789 BitOrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOr#::bitorrust-analyzer cargo colored 3.1.1 style/impl#[`&Styles`][`BitOr<&Style>`]bitor().,
790 Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Reversedrust-analyzer cargo colored 3.1.1 style/Styles#Reversed#
791 => Stylerust-analyzer cargo colored 3.1.1 style/Style#(0b0000_0111)
792 );
793 check_impl_reflexiverust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/check_impl_reflexive!!(
794 bold_underline,
795 BitXorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitXor#::bitxorrust-analyzer cargo colored 3.1.1 style/impl#[`&Styles`][`BitXor<&Style>`]bitxor().,
796 Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Underlinerust-analyzer cargo colored 3.1.1 style/Styles#Underline#
797 => Stylerust-analyzer cargo colored 3.1.1 style/Style#(0b0000_0001)
798 );
799 }
800
801 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
802 fn notrust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/not().() {
803 let not_bold = !rust-analyzer cargo colored 3.1.1 style/impl#[Style][Not]not().Stylerust-analyzer cargo colored 3.1.1 style/Style#(BOLDrust-analyzer cargo colored 3.1.1 style/BOLD.);
804 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().not_bold.containsrust-analyzer cargo colored 3.1.1 style/impl#[Style]contains().(Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#));
805 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(not_bold.containsrust-analyzer cargo colored 3.1.1 style/impl#[Style]contains().(Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Strikethroughrust-analyzer cargo colored 3.1.1 style/Styles#Strikethrough#));
806 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(!rust-analyzer cargo colored 3.1.1 style/impl#[Style][Not]not().Stylerust-analyzer cargo colored 3.1.1 style/Style#(0b0011_0101), Stylerust-analyzer cargo colored 3.1.1 style/Style#(0b1100_1010));
807 }
808
809 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
810 fn assign_opsrust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/assign_ops().() {
811 let original_style = Stylerust-analyzer cargo colored 3.1.1 style/Style#(0b0011);
812 let op_style = Stylerust-analyzer cargo colored 3.1.1 style/Style#(0b0101);
813
814 let mut style = original_style;
815 style rust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitAndAssign<Self>`]bitand_assign().&=rust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitAndAssign<Self>`]bitand_assign(). rust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitAndAssign<Self>`]bitand_assign().op_style;
816 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(style, Stylerust-analyzer cargo colored 3.1.1 style/Style#(0b0001));
817
818 style = original_style;
819 style rust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitOrAssign<Self>`]bitor_assign().op_style;
820 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(style, Stylerust-analyzer cargo colored 3.1.1 style/Style#(0b0111));
821
822 style = original_style;
823 style rust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitXorAssign<Self>`]bitxor_assign().^=rust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitXorAssign<Self>`]bitxor_assign(). rust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitXorAssign<Self>`]bitxor_assign().op_style;
824 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(style, Stylerust-analyzer cargo colored 3.1.1 style/Style#(0b0110));
825 }
826
827 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
828 fn assign_ops_with_stylesrust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/assign_ops_with_styles().() {
829 let original_style = Stylerust-analyzer cargo colored 3.1.1 style/Style#(0b0011);
830
831 let mut style = original_style;
832 style rust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitAndAssign<Styles>`]bitand_assign().&=rust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitAndAssign<Styles>`]bitand_assign(). rust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitAndAssign<Styles>`]bitand_assign().Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#;
833 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(style, Stylerust-analyzer cargo colored 3.1.1 style/Style#(0b0001));
834
835 style = original_style;
836 style rust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitOrAssign<Styles>`]bitor_assign().|=rust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitOrAssign<Styles>`]bitor_assign(). rust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitOrAssign<Styles>`]bitor_assign().Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Reversedrust-analyzer cargo colored 3.1.1 style/Styles#Reversed#;
837 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(style, Stylerust-analyzer cargo colored 3.1.1 style/Style#(0b0111));
838
839 style = original_style;
840 style rust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitXorAssign<Styles>`]bitxor_assign().^=rust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitXorAssign<Styles>`]bitxor_assign(). rust-analyzer cargo colored 3.1.1 style/impl#[Style][`BitXorAssign<Styles>`]bitxor_assign().Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#;
841 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(style, Stylerust-analyzer cargo colored 3.1.1 style/Style#(0b0010));
842 }
843
844 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
845 fn styles_binopsrust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/styles_binops().() {
846 check_implrust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/check_impl!!(
847 Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#,
848 BitAndrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitAnd#::bitandrust-analyzer cargo colored 3.1.1 style/impl#[`&Styles`][`BitAnd<Self>`]bitand().,
849 Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#
850 => Stylerust-analyzer cargo colored 3.1.1 style/Style#(0b0000_0001)
851 );
852 // The check_impl is only to verify it works with all the combos
853 // of refs. We already know it compines so let's spare ourselves
854 // the extra assertions.
855 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold# &rust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitAnd<Self>`]bitand(). Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Underlinerust-analyzer cargo colored 3.1.1 style/Styles#Underline#, Stylerust-analyzer cargo colored 3.1.1 style/Style#(0b0000_0000));
856
857 check_implrust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/check_impl!!(
858 Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#,
859 BitOrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOr#::bitorrust-analyzer cargo colored 3.1.1 style/impl#[`&Styles`][`BitOr<Self>`]bitor().,
860 Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Underlinerust-analyzer cargo colored 3.1.1 style/Styles#Underline#
861 => Stylerust-analyzer cargo colored 3.1.1 style/Style#(0b0000_0011)
862 );
863 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold# |rust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitOr<Self>`]bitor(). Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#, Stylerust-analyzer cargo colored 3.1.1 style/Style#(0b0000_0001));
864
865 check_implrust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/check_impl!!(
866 Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#,
867 BitXorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitXor#::bitxorrust-analyzer cargo colored 3.1.1 style/impl#[`&Styles`][`BitXor<Self>`]bitxor().,
868 Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Underlinerust-analyzer cargo colored 3.1.1 style/Styles#Underline#
869 => Stylerust-analyzer cargo colored 3.1.1 style/Style#(0b0000_0011)
870 );
871 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold# ^rust-analyzer cargo colored 3.1.1 style/impl#[Styles][`BitXor<Self>`]bitxor(). Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#, Stylerust-analyzer cargo colored 3.1.1 style/Style#(0b0000_0000));
872 }
873
874 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
875 fn styles_notrust-analyzer cargo colored 3.1.1 style/tests/style_bitwise_logic/styles_not().() {
876 let not_bold = !rust-analyzer cargo colored 3.1.1 style/impl#[Styles][Not]not().Stylesrust-analyzer cargo colored 3.1.1 style/Styles#::Boldrust-analyzer cargo colored 3.1.1 style/Styles#Bold#;
877 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(not_bold, Stylerust-analyzer cargo colored 3.1.1 style/Style#(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][Not]not().BOLDrust-analyzer cargo colored 3.1.1 style/BOLD.));
878 }
879 }
880 }