@@ -173,7 +173,7 @@ impl Default for Style {
173
173
174
174
impl Style {
175
175
/// Returns an empty default style.
176
- pub fn new ( ) -> Self {
176
+ pub const fn new ( ) -> Self {
177
177
Self {
178
178
fg : None ,
179
179
bg : None ,
@@ -253,14 +253,14 @@ impl Style {
253
253
///
254
254
/// This overrides the automatic detection.
255
255
#[ inline]
256
- pub fn force_styling ( mut self , value : bool ) -> Self {
256
+ pub const fn force_styling ( mut self , value : bool ) -> Self {
257
257
self . force = Some ( value) ;
258
258
self
259
259
}
260
260
261
261
/// Specifies that style is applying to something being written on stderr.
262
262
#[ inline]
263
- pub fn for_stderr ( mut self ) -> Self {
263
+ pub const fn for_stderr ( mut self ) -> Self {
264
264
self . for_stderr = true ;
265
265
self
266
266
}
@@ -269,21 +269,21 @@ impl Style {
269
269
///
270
270
/// This is the default behaviour.
271
271
#[ inline]
272
- pub fn for_stdout ( mut self ) -> Self {
272
+ pub const fn for_stdout ( mut self ) -> Self {
273
273
self . for_stderr = false ;
274
274
self
275
275
}
276
276
277
277
/// Sets a foreground color.
278
278
#[ inline]
279
- pub fn fg ( mut self , color : Color ) -> Self {
279
+ pub const fn fg ( mut self , color : Color ) -> Self {
280
280
self . fg = Some ( color) ;
281
281
self
282
282
}
283
283
284
284
/// Sets a background color.
285
285
#[ inline]
286
- pub fn bg ( mut self , color : Color ) -> Self {
286
+ pub const fn bg ( mut self , color : Color ) -> Self {
287
287
self . bg = Some ( color) ;
288
288
self
289
289
}
@@ -296,87 +296,87 @@ impl Style {
296
296
}
297
297
298
298
#[ inline]
299
- pub fn black ( self ) -> Self {
299
+ pub const fn black ( self ) -> Self {
300
300
self . fg ( Color :: Black )
301
301
}
302
302
#[ inline]
303
- pub fn red ( self ) -> Self {
303
+ pub const fn red ( self ) -> Self {
304
304
self . fg ( Color :: Red )
305
305
}
306
306
#[ inline]
307
- pub fn green ( self ) -> Self {
307
+ pub const fn green ( self ) -> Self {
308
308
self . fg ( Color :: Green )
309
309
}
310
310
#[ inline]
311
- pub fn yellow ( self ) -> Self {
311
+ pub const fn yellow ( self ) -> Self {
312
312
self . fg ( Color :: Yellow )
313
313
}
314
314
#[ inline]
315
- pub fn blue ( self ) -> Self {
315
+ pub const fn blue ( self ) -> Self {
316
316
self . fg ( Color :: Blue )
317
317
}
318
318
#[ inline]
319
- pub fn magenta ( self ) -> Self {
319
+ pub const fn magenta ( self ) -> Self {
320
320
self . fg ( Color :: Magenta )
321
321
}
322
322
#[ inline]
323
- pub fn cyan ( self ) -> Self {
323
+ pub const fn cyan ( self ) -> Self {
324
324
self . fg ( Color :: Cyan )
325
325
}
326
326
#[ inline]
327
- pub fn white ( self ) -> Self {
327
+ pub const fn white ( self ) -> Self {
328
328
self . fg ( Color :: White )
329
329
}
330
330
#[ inline]
331
- pub fn color256 ( self , color : u8 ) -> Self {
331
+ pub const fn color256 ( self , color : u8 ) -> Self {
332
332
self . fg ( Color :: Color256 ( color) )
333
333
}
334
334
335
335
#[ inline]
336
- pub fn bright ( mut self ) -> Self {
336
+ pub const fn bright ( mut self ) -> Self {
337
337
self . fg_bright = true ;
338
338
self
339
339
}
340
340
341
341
#[ inline]
342
- pub fn on_black ( self ) -> Self {
342
+ pub const fn on_black ( self ) -> Self {
343
343
self . bg ( Color :: Black )
344
344
}
345
345
#[ inline]
346
- pub fn on_red ( self ) -> Self {
346
+ pub const fn on_red ( self ) -> Self {
347
347
self . bg ( Color :: Red )
348
348
}
349
349
#[ inline]
350
- pub fn on_green ( self ) -> Self {
350
+ pub const fn on_green ( self ) -> Self {
351
351
self . bg ( Color :: Green )
352
352
}
353
353
#[ inline]
354
- pub fn on_yellow ( self ) -> Self {
354
+ pub const fn on_yellow ( self ) -> Self {
355
355
self . bg ( Color :: Yellow )
356
356
}
357
357
#[ inline]
358
- pub fn on_blue ( self ) -> Self {
358
+ pub const fn on_blue ( self ) -> Self {
359
359
self . bg ( Color :: Blue )
360
360
}
361
361
#[ inline]
362
- pub fn on_magenta ( self ) -> Self {
362
+ pub const fn on_magenta ( self ) -> Self {
363
363
self . bg ( Color :: Magenta )
364
364
}
365
365
#[ inline]
366
- pub fn on_cyan ( self ) -> Self {
366
+ pub const fn on_cyan ( self ) -> Self {
367
367
self . bg ( Color :: Cyan )
368
368
}
369
369
#[ inline]
370
- pub fn on_white ( self ) -> Self {
370
+ pub const fn on_white ( self ) -> Self {
371
371
self . bg ( Color :: White )
372
372
}
373
373
#[ inline]
374
- pub fn on_color256 ( self , color : u8 ) -> Self {
374
+ pub const fn on_color256 ( self , color : u8 ) -> Self {
375
375
self . bg ( Color :: Color256 ( color) )
376
376
}
377
377
378
378
#[ inline]
379
- pub fn on_bright ( mut self ) -> Self {
379
+ pub const fn on_bright ( mut self ) -> Self {
380
380
self . bg_bright = true ;
381
381
self
382
382
}
0 commit comments