File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,16 +18,21 @@ pub struct ContentStyle {
1818}
1919
2020impl ContentStyle {
21- /// Creates a `StyledContent` by applying the style to the given `val`.
21+ /// Creates a [ `StyledContent`] by applying the style to the given `val`.
2222 #[ inline]
23- pub fn apply < D : Display > ( self , val : D ) -> StyledContent < D > {
23+ pub const fn apply < D : Display > ( self , val : D ) -> StyledContent < D > {
2424 StyledContent :: new ( self , val)
2525 }
2626
27- /// Creates a new `ContentStyle`.
27+ /// Creates a new [ `ContentStyle`] .
2828 #[ inline]
29- pub fn new ( ) -> ContentStyle {
30- ContentStyle :: default ( )
29+ pub const fn new ( ) -> ContentStyle {
30+ Self {
31+ foreground_color : None ,
32+ background_color : None ,
33+ underline_color : None ,
34+ attributes : Attributes :: none ( ) ,
35+ }
3136 }
3237}
3338
Original file line number Diff line number Diff line change @@ -27,28 +27,28 @@ pub struct StyledContent<D: Display> {
2727}
2828
2929impl < D : Display > StyledContent < D > {
30- /// Creates a new `StyledContent`.
30+ /// Creates a new [ `StyledContent`] .
3131 #[ inline]
32- pub fn new ( style : ContentStyle , content : D ) -> StyledContent < D > {
32+ pub const fn new ( style : ContentStyle , content : D ) -> StyledContent < D > {
3333 StyledContent { style, content }
3434 }
3535
3636 /// Returns the content.
3737 #[ inline]
38- pub fn content ( & self ) -> & D {
38+ pub const fn content ( & self ) -> & D {
3939 & self . content
4040 }
4141
4242 /// Returns the style.
4343 #[ inline]
44- pub fn style ( & self ) -> & ContentStyle {
44+ pub const fn style ( & self ) -> & ContentStyle {
4545 & self . style
4646 }
4747
4848 /// Returns a mutable reference to the style, so that it can be further
4949 /// manipulated
5050 #[ inline]
51- pub fn style_mut ( & mut self ) -> & mut ContentStyle {
51+ pub const fn style_mut ( & mut self ) -> & mut ContentStyle {
5252 & mut self . style
5353 }
5454}
You can’t perform that action at this time.
0 commit comments