@@ -343,7 +343,7 @@ impl Style {
343343
344344 /// Adds a attr.
345345 #[ inline]
346- pub fn attr ( mut self , attr : Attribute ) -> Self {
346+ pub const fn attr ( mut self , attr : Attribute ) -> Self {
347347 self . attrs = self . attrs . insert ( attr) ;
348348 self
349349 }
@@ -435,39 +435,39 @@ impl Style {
435435 }
436436
437437 #[ inline]
438- pub fn bold ( self ) -> Self {
438+ pub const fn bold ( self ) -> Self {
439439 self . attr ( Attribute :: Bold )
440440 }
441441 #[ inline]
442- pub fn dim ( self ) -> Self {
442+ pub const fn dim ( self ) -> Self {
443443 self . attr ( Attribute :: Dim )
444444 }
445445 #[ inline]
446- pub fn italic ( self ) -> Self {
446+ pub const fn italic ( self ) -> Self {
447447 self . attr ( Attribute :: Italic )
448448 }
449449 #[ inline]
450- pub fn underlined ( self ) -> Self {
450+ pub const fn underlined ( self ) -> Self {
451451 self . attr ( Attribute :: Underlined )
452452 }
453453 #[ inline]
454- pub fn blink ( self ) -> Self {
454+ pub const fn blink ( self ) -> Self {
455455 self . attr ( Attribute :: Blink )
456456 }
457457 #[ inline]
458- pub fn blink_fast ( self ) -> Self {
458+ pub const fn blink_fast ( self ) -> Self {
459459 self . attr ( Attribute :: BlinkFast )
460460 }
461461 #[ inline]
462- pub fn reverse ( self ) -> Self {
462+ pub const fn reverse ( self ) -> Self {
463463 self . attr ( Attribute :: Reverse )
464464 }
465465 #[ inline]
466- pub fn hidden ( self ) -> Self {
466+ pub const fn hidden ( self ) -> Self {
467467 self . attr ( Attribute :: Hidden )
468468 }
469469 #[ inline]
470- pub fn strikethrough ( self ) -> Self {
470+ pub const fn strikethrough ( self ) -> Self {
471471 self . attr ( Attribute :: StrikeThrough )
472472 }
473473}
@@ -520,152 +520,152 @@ impl<D> StyledObject<D> {
520520 ///
521521 /// This is the default
522522 #[ inline]
523- pub fn for_stdout ( mut self ) -> StyledObject < D > {
523+ pub const fn for_stdout ( mut self ) -> StyledObject < D > {
524524 self . style = self . style . for_stdout ( ) ;
525525 self
526526 }
527527
528528 /// Sets a foreground color.
529529 #[ inline]
530- pub fn fg ( mut self , color : Color ) -> StyledObject < D > {
530+ pub const fn fg ( mut self , color : Color ) -> StyledObject < D > {
531531 self . style = self . style . fg ( color) ;
532532 self
533533 }
534534
535535 /// Sets a background color.
536536 #[ inline]
537- pub fn bg ( mut self , color : Color ) -> StyledObject < D > {
537+ pub const fn bg ( mut self , color : Color ) -> StyledObject < D > {
538538 self . style = self . style . bg ( color) ;
539539 self
540540 }
541541
542542 /// Adds a attr.
543543 #[ inline]
544- pub fn attr ( mut self , attr : Attribute ) -> StyledObject < D > {
544+ pub const fn attr ( mut self , attr : Attribute ) -> StyledObject < D > {
545545 self . style = self . style . attr ( attr) ;
546546 self
547547 }
548548
549549 #[ inline]
550- pub fn black ( self ) -> StyledObject < D > {
550+ pub const fn black ( self ) -> StyledObject < D > {
551551 self . fg ( Color :: Black )
552552 }
553553 #[ inline]
554- pub fn red ( self ) -> StyledObject < D > {
554+ pub const fn red ( self ) -> StyledObject < D > {
555555 self . fg ( Color :: Red )
556556 }
557557 #[ inline]
558- pub fn green ( self ) -> StyledObject < D > {
558+ pub const fn green ( self ) -> StyledObject < D > {
559559 self . fg ( Color :: Green )
560560 }
561561 #[ inline]
562- pub fn yellow ( self ) -> StyledObject < D > {
562+ pub const fn yellow ( self ) -> StyledObject < D > {
563563 self . fg ( Color :: Yellow )
564564 }
565565 #[ inline]
566- pub fn blue ( self ) -> StyledObject < D > {
566+ pub const fn blue ( self ) -> StyledObject < D > {
567567 self . fg ( Color :: Blue )
568568 }
569569 #[ inline]
570- pub fn magenta ( self ) -> StyledObject < D > {
570+ pub const fn magenta ( self ) -> StyledObject < D > {
571571 self . fg ( Color :: Magenta )
572572 }
573573 #[ inline]
574- pub fn cyan ( self ) -> StyledObject < D > {
574+ pub const fn cyan ( self ) -> StyledObject < D > {
575575 self . fg ( Color :: Cyan )
576576 }
577577 #[ inline]
578- pub fn white ( self ) -> StyledObject < D > {
578+ pub const fn white ( self ) -> StyledObject < D > {
579579 self . fg ( Color :: White )
580580 }
581581 #[ inline]
582- pub fn color256 ( self , color : u8 ) -> StyledObject < D > {
582+ pub const fn color256 ( self , color : u8 ) -> StyledObject < D > {
583583 self . fg ( Color :: Color256 ( color) )
584584 }
585585
586586 #[ inline]
587- pub fn bright ( mut self ) -> StyledObject < D > {
587+ pub const fn bright ( mut self ) -> StyledObject < D > {
588588 self . style = self . style . bright ( ) ;
589589 self
590590 }
591591
592592 #[ inline]
593- pub fn on_black ( self ) -> StyledObject < D > {
593+ pub const fn on_black ( self ) -> StyledObject < D > {
594594 self . bg ( Color :: Black )
595595 }
596596 #[ inline]
597- pub fn on_red ( self ) -> StyledObject < D > {
597+ pub const fn on_red ( self ) -> StyledObject < D > {
598598 self . bg ( Color :: Red )
599599 }
600600 #[ inline]
601- pub fn on_green ( self ) -> StyledObject < D > {
601+ pub const fn on_green ( self ) -> StyledObject < D > {
602602 self . bg ( Color :: Green )
603603 }
604604 #[ inline]
605- pub fn on_yellow ( self ) -> StyledObject < D > {
605+ pub const fn on_yellow ( self ) -> StyledObject < D > {
606606 self . bg ( Color :: Yellow )
607607 }
608608 #[ inline]
609- pub fn on_blue ( self ) -> StyledObject < D > {
609+ pub const fn on_blue ( self ) -> StyledObject < D > {
610610 self . bg ( Color :: Blue )
611611 }
612612 #[ inline]
613- pub fn on_magenta ( self ) -> StyledObject < D > {
613+ pub const fn on_magenta ( self ) -> StyledObject < D > {
614614 self . bg ( Color :: Magenta )
615615 }
616616 #[ inline]
617- pub fn on_cyan ( self ) -> StyledObject < D > {
617+ pub const fn on_cyan ( self ) -> StyledObject < D > {
618618 self . bg ( Color :: Cyan )
619619 }
620620 #[ inline]
621- pub fn on_white ( self ) -> StyledObject < D > {
621+ pub const fn on_white ( self ) -> StyledObject < D > {
622622 self . bg ( Color :: White )
623623 }
624624 #[ inline]
625- pub fn on_color256 ( self , color : u8 ) -> StyledObject < D > {
625+ pub const fn on_color256 ( self , color : u8 ) -> StyledObject < D > {
626626 self . bg ( Color :: Color256 ( color) )
627627 }
628628
629629 #[ inline]
630- pub fn on_bright ( mut self ) -> StyledObject < D > {
630+ pub const fn on_bright ( mut self ) -> StyledObject < D > {
631631 self . style = self . style . on_bright ( ) ;
632632 self
633633 }
634634
635635 #[ inline]
636- pub fn bold ( self ) -> StyledObject < D > {
636+ pub const fn bold ( self ) -> StyledObject < D > {
637637 self . attr ( Attribute :: Bold )
638638 }
639639 #[ inline]
640- pub fn dim ( self ) -> StyledObject < D > {
640+ pub const fn dim ( self ) -> StyledObject < D > {
641641 self . attr ( Attribute :: Dim )
642642 }
643643 #[ inline]
644- pub fn italic ( self ) -> StyledObject < D > {
644+ pub const fn italic ( self ) -> StyledObject < D > {
645645 self . attr ( Attribute :: Italic )
646646 }
647647 #[ inline]
648- pub fn underlined ( self ) -> StyledObject < D > {
648+ pub const fn underlined ( self ) -> StyledObject < D > {
649649 self . attr ( Attribute :: Underlined )
650650 }
651651 #[ inline]
652- pub fn blink ( self ) -> StyledObject < D > {
652+ pub const fn blink ( self ) -> StyledObject < D > {
653653 self . attr ( Attribute :: Blink )
654654 }
655655 #[ inline]
656- pub fn blink_fast ( self ) -> StyledObject < D > {
656+ pub const fn blink_fast ( self ) -> StyledObject < D > {
657657 self . attr ( Attribute :: BlinkFast )
658658 }
659659 #[ inline]
660- pub fn reverse ( self ) -> StyledObject < D > {
660+ pub const fn reverse ( self ) -> StyledObject < D > {
661661 self . attr ( Attribute :: Reverse )
662662 }
663663 #[ inline]
664- pub fn hidden ( self ) -> StyledObject < D > {
664+ pub const fn hidden ( self ) -> StyledObject < D > {
665665 self . attr ( Attribute :: Hidden )
666666 }
667667 #[ inline]
668- pub fn strikethrough ( self ) -> StyledObject < D > {
668+ pub const fn strikethrough ( self ) -> StyledObject < D > {
669669 self . attr ( Attribute :: StrikeThrough )
670670 }
671671}
0 commit comments