@@ -3,8 +3,6 @@ extern crate num_traits;
3
3
extern crate termbox_sys as termbox;
4
4
#[ macro_use] extern crate bitflags;
5
5
6
- pub use self :: style:: { Style , RB_BOLD , RB_UNDERLINE , RB_REVERSE , RB_NORMAL } ;
7
-
8
6
use std:: error:: Error ;
9
7
use std:: fmt;
10
8
use std:: io;
@@ -112,27 +110,25 @@ impl Default for Color {
112
110
}
113
111
}
114
112
115
- mod style {
116
- bitflags ! {
117
- #[ repr( C ) ]
118
- flags Style : u16 {
119
- const TB_NORMAL_COLOR = 0x000F ,
120
- const RB_BOLD = 0x0100 ,
121
- const RB_UNDERLINE = 0x0200 ,
122
- const RB_REVERSE = 0x0400 ,
123
- const RB_NORMAL = 0x0000 ,
124
- const TB_ATTRIB = RB_BOLD . bits | RB_UNDERLINE . bits | RB_REVERSE . bits,
125
- }
113
+ bitflags ! {
114
+ #[ repr( C ) ]
115
+ pub struct Style : u16 {
116
+ const TB_NORMAL_COLOR = 0x000F ;
117
+ const RB_BOLD = 0x0100 ;
118
+ const RB_UNDERLINE = 0x0200 ;
119
+ const RB_REVERSE = 0x0400 ;
120
+ const RB_NORMAL = 0x0000 ;
121
+ const TB_ATTRIB = Style :: RB_BOLD . bits | Style :: RB_UNDERLINE . bits | Style :: RB_REVERSE . bits;
126
122
}
123
+ }
127
124
128
- impl Style {
129
- pub fn from_color ( color : super :: Color ) -> Style {
130
- Style { bits : color. as_16color ( ) & TB_NORMAL_COLOR . bits }
131
- }
125
+ impl Style {
126
+ pub fn from_color ( color : Color ) -> Style {
127
+ Style { bits : color. as_16color ( ) & Style :: TB_NORMAL_COLOR . bits }
128
+ }
132
129
133
- pub fn from_256color ( color : super :: Color ) -> Style {
134
- Style { bits : color. as_256color ( ) }
135
- }
130
+ pub fn from_256color ( color : Color ) -> Style {
131
+ Style { bits : color. as_256color ( ) }
136
132
}
137
133
}
138
134
@@ -460,13 +456,13 @@ impl RustBox {
460
456
match self . output_mode {
461
457
// 256 color mode
462
458
OutputMode :: EightBit => {
463
- fg_int = Style :: from_256color ( fg) | ( sty & style :: TB_ATTRIB ) ;
459
+ fg_int = Style :: from_256color ( fg) | ( sty & Style :: TB_ATTRIB ) ;
464
460
bg_int = Style :: from_256color ( bg) ;
465
461
} ,
466
462
467
463
// 16 color mode
468
464
_ => {
469
- fg_int = Style :: from_color ( fg) | ( sty & style :: TB_ATTRIB ) ;
465
+ fg_int = Style :: from_color ( fg) | ( sty & Style :: TB_ATTRIB ) ;
470
466
bg_int = Style :: from_color ( bg) ;
471
467
}
472
468
}
@@ -487,13 +483,13 @@ impl RustBox {
487
483
match self . output_mode {
488
484
// 256 color mode
489
485
OutputMode :: EightBit => {
490
- fg_int = Style :: from_256color ( fg) | ( sty & style :: TB_ATTRIB ) ;
486
+ fg_int = Style :: from_256color ( fg) | ( sty & Style :: TB_ATTRIB ) ;
491
487
bg_int = Style :: from_256color ( bg) ;
492
488
} ,
493
489
494
490
// 16 color mode
495
491
_ => {
496
- fg_int = Style :: from_color ( fg) | ( sty & style :: TB_ATTRIB ) ;
492
+ fg_int = Style :: from_color ( fg) | ( sty & Style :: TB_ATTRIB ) ;
497
493
bg_int = Style :: from_color ( bg) ;
498
494
}
499
495
}
0 commit comments