@@ -343,7 +343,7 @@ impl Style {
343
343
344
344
/// Adds a attr.
345
345
#[ inline]
346
- pub fn attr ( mut self , attr : Attribute ) -> Self {
346
+ pub const fn attr ( mut self , attr : Attribute ) -> Self {
347
347
self . attrs = self . attrs . insert ( attr) ;
348
348
self
349
349
}
@@ -435,39 +435,39 @@ impl Style {
435
435
}
436
436
437
437
#[ inline]
438
- pub fn bold ( self ) -> Self {
438
+ pub const fn bold ( self ) -> Self {
439
439
self . attr ( Attribute :: Bold )
440
440
}
441
441
#[ inline]
442
- pub fn dim ( self ) -> Self {
442
+ pub const fn dim ( self ) -> Self {
443
443
self . attr ( Attribute :: Dim )
444
444
}
445
445
#[ inline]
446
- pub fn italic ( self ) -> Self {
446
+ pub const fn italic ( self ) -> Self {
447
447
self . attr ( Attribute :: Italic )
448
448
}
449
449
#[ inline]
450
- pub fn underlined ( self ) -> Self {
450
+ pub const fn underlined ( self ) -> Self {
451
451
self . attr ( Attribute :: Underlined )
452
452
}
453
453
#[ inline]
454
- pub fn blink ( self ) -> Self {
454
+ pub const fn blink ( self ) -> Self {
455
455
self . attr ( Attribute :: Blink )
456
456
}
457
457
#[ inline]
458
- pub fn blink_fast ( self ) -> Self {
458
+ pub const fn blink_fast ( self ) -> Self {
459
459
self . attr ( Attribute :: BlinkFast )
460
460
}
461
461
#[ inline]
462
- pub fn reverse ( self ) -> Self {
462
+ pub const fn reverse ( self ) -> Self {
463
463
self . attr ( Attribute :: Reverse )
464
464
}
465
465
#[ inline]
466
- pub fn hidden ( self ) -> Self {
466
+ pub const fn hidden ( self ) -> Self {
467
467
self . attr ( Attribute :: Hidden )
468
468
}
469
469
#[ inline]
470
- pub fn strikethrough ( self ) -> Self {
470
+ pub const fn strikethrough ( self ) -> Self {
471
471
self . attr ( Attribute :: StrikeThrough )
472
472
}
473
473
}
@@ -520,152 +520,152 @@ impl<D> StyledObject<D> {
520
520
///
521
521
/// This is the default
522
522
#[ inline]
523
- pub fn for_stdout ( mut self ) -> StyledObject < D > {
523
+ pub const fn for_stdout ( mut self ) -> StyledObject < D > {
524
524
self . style = self . style . for_stdout ( ) ;
525
525
self
526
526
}
527
527
528
528
/// Sets a foreground color.
529
529
#[ inline]
530
- pub fn fg ( mut self , color : Color ) -> StyledObject < D > {
530
+ pub const fn fg ( mut self , color : Color ) -> StyledObject < D > {
531
531
self . style = self . style . fg ( color) ;
532
532
self
533
533
}
534
534
535
535
/// Sets a background color.
536
536
#[ inline]
537
- pub fn bg ( mut self , color : Color ) -> StyledObject < D > {
537
+ pub const fn bg ( mut self , color : Color ) -> StyledObject < D > {
538
538
self . style = self . style . bg ( color) ;
539
539
self
540
540
}
541
541
542
542
/// Adds a attr.
543
543
#[ inline]
544
- pub fn attr ( mut self , attr : Attribute ) -> StyledObject < D > {
544
+ pub const fn attr ( mut self , attr : Attribute ) -> StyledObject < D > {
545
545
self . style = self . style . attr ( attr) ;
546
546
self
547
547
}
548
548
549
549
#[ inline]
550
- pub fn black ( self ) -> StyledObject < D > {
550
+ pub const fn black ( self ) -> StyledObject < D > {
551
551
self . fg ( Color :: Black )
552
552
}
553
553
#[ inline]
554
- pub fn red ( self ) -> StyledObject < D > {
554
+ pub const fn red ( self ) -> StyledObject < D > {
555
555
self . fg ( Color :: Red )
556
556
}
557
557
#[ inline]
558
- pub fn green ( self ) -> StyledObject < D > {
558
+ pub const fn green ( self ) -> StyledObject < D > {
559
559
self . fg ( Color :: Green )
560
560
}
561
561
#[ inline]
562
- pub fn yellow ( self ) -> StyledObject < D > {
562
+ pub const fn yellow ( self ) -> StyledObject < D > {
563
563
self . fg ( Color :: Yellow )
564
564
}
565
565
#[ inline]
566
- pub fn blue ( self ) -> StyledObject < D > {
566
+ pub const fn blue ( self ) -> StyledObject < D > {
567
567
self . fg ( Color :: Blue )
568
568
}
569
569
#[ inline]
570
- pub fn magenta ( self ) -> StyledObject < D > {
570
+ pub const fn magenta ( self ) -> StyledObject < D > {
571
571
self . fg ( Color :: Magenta )
572
572
}
573
573
#[ inline]
574
- pub fn cyan ( self ) -> StyledObject < D > {
574
+ pub const fn cyan ( self ) -> StyledObject < D > {
575
575
self . fg ( Color :: Cyan )
576
576
}
577
577
#[ inline]
578
- pub fn white ( self ) -> StyledObject < D > {
578
+ pub const fn white ( self ) -> StyledObject < D > {
579
579
self . fg ( Color :: White )
580
580
}
581
581
#[ inline]
582
- pub fn color256 ( self , color : u8 ) -> StyledObject < D > {
582
+ pub const fn color256 ( self , color : u8 ) -> StyledObject < D > {
583
583
self . fg ( Color :: Color256 ( color) )
584
584
}
585
585
586
586
#[ inline]
587
- pub fn bright ( mut self ) -> StyledObject < D > {
587
+ pub const fn bright ( mut self ) -> StyledObject < D > {
588
588
self . style = self . style . bright ( ) ;
589
589
self
590
590
}
591
591
592
592
#[ inline]
593
- pub fn on_black ( self ) -> StyledObject < D > {
593
+ pub const fn on_black ( self ) -> StyledObject < D > {
594
594
self . bg ( Color :: Black )
595
595
}
596
596
#[ inline]
597
- pub fn on_red ( self ) -> StyledObject < D > {
597
+ pub const fn on_red ( self ) -> StyledObject < D > {
598
598
self . bg ( Color :: Red )
599
599
}
600
600
#[ inline]
601
- pub fn on_green ( self ) -> StyledObject < D > {
601
+ pub const fn on_green ( self ) -> StyledObject < D > {
602
602
self . bg ( Color :: Green )
603
603
}
604
604
#[ inline]
605
- pub fn on_yellow ( self ) -> StyledObject < D > {
605
+ pub const fn on_yellow ( self ) -> StyledObject < D > {
606
606
self . bg ( Color :: Yellow )
607
607
}
608
608
#[ inline]
609
- pub fn on_blue ( self ) -> StyledObject < D > {
609
+ pub const fn on_blue ( self ) -> StyledObject < D > {
610
610
self . bg ( Color :: Blue )
611
611
}
612
612
#[ inline]
613
- pub fn on_magenta ( self ) -> StyledObject < D > {
613
+ pub const fn on_magenta ( self ) -> StyledObject < D > {
614
614
self . bg ( Color :: Magenta )
615
615
}
616
616
#[ inline]
617
- pub fn on_cyan ( self ) -> StyledObject < D > {
617
+ pub const fn on_cyan ( self ) -> StyledObject < D > {
618
618
self . bg ( Color :: Cyan )
619
619
}
620
620
#[ inline]
621
- pub fn on_white ( self ) -> StyledObject < D > {
621
+ pub const fn on_white ( self ) -> StyledObject < D > {
622
622
self . bg ( Color :: White )
623
623
}
624
624
#[ inline]
625
- pub fn on_color256 ( self , color : u8 ) -> StyledObject < D > {
625
+ pub const fn on_color256 ( self , color : u8 ) -> StyledObject < D > {
626
626
self . bg ( Color :: Color256 ( color) )
627
627
}
628
628
629
629
#[ inline]
630
- pub fn on_bright ( mut self ) -> StyledObject < D > {
630
+ pub const fn on_bright ( mut self ) -> StyledObject < D > {
631
631
self . style = self . style . on_bright ( ) ;
632
632
self
633
633
}
634
634
635
635
#[ inline]
636
- pub fn bold ( self ) -> StyledObject < D > {
636
+ pub const fn bold ( self ) -> StyledObject < D > {
637
637
self . attr ( Attribute :: Bold )
638
638
}
639
639
#[ inline]
640
- pub fn dim ( self ) -> StyledObject < D > {
640
+ pub const fn dim ( self ) -> StyledObject < D > {
641
641
self . attr ( Attribute :: Dim )
642
642
}
643
643
#[ inline]
644
- pub fn italic ( self ) -> StyledObject < D > {
644
+ pub const fn italic ( self ) -> StyledObject < D > {
645
645
self . attr ( Attribute :: Italic )
646
646
}
647
647
#[ inline]
648
- pub fn underlined ( self ) -> StyledObject < D > {
648
+ pub const fn underlined ( self ) -> StyledObject < D > {
649
649
self . attr ( Attribute :: Underlined )
650
650
}
651
651
#[ inline]
652
- pub fn blink ( self ) -> StyledObject < D > {
652
+ pub const fn blink ( self ) -> StyledObject < D > {
653
653
self . attr ( Attribute :: Blink )
654
654
}
655
655
#[ inline]
656
- pub fn blink_fast ( self ) -> StyledObject < D > {
656
+ pub const fn blink_fast ( self ) -> StyledObject < D > {
657
657
self . attr ( Attribute :: BlinkFast )
658
658
}
659
659
#[ inline]
660
- pub fn reverse ( self ) -> StyledObject < D > {
660
+ pub const fn reverse ( self ) -> StyledObject < D > {
661
661
self . attr ( Attribute :: Reverse )
662
662
}
663
663
#[ inline]
664
- pub fn hidden ( self ) -> StyledObject < D > {
664
+ pub const fn hidden ( self ) -> StyledObject < D > {
665
665
self . attr ( Attribute :: Hidden )
666
666
}
667
667
#[ inline]
668
- pub fn strikethrough ( self ) -> StyledObject < D > {
668
+ pub const fn strikethrough ( self ) -> StyledObject < D > {
669
669
self . attr ( Attribute :: StrikeThrough )
670
670
}
671
671
}
0 commit comments