minicrossterm/crossterm_style/src/macros.rs
Timon 1e332daaed
Refactor and API stabilization (#115)
- Major refactor and cleanup.
- Improved performance; 
    - No locking when writing to stdout. 
    - UNIX doesn't have any dynamic dispatch anymore. 
    - Windows has improved the way to check if ANSI modes are enabled.
    - Removed lot's of complex API calls: `from_screen`, `from_output`
    - Removed `Arc<TerminalOutput>` from all internal Api's. 
- Removed termios dependency for UNIX systems.
- Upgraded deps.
- Removed about 1000 lines of code
    - `TerminalOutput` 
    - `Screen`
    - unsafe code
    - Some duplicated code introduced by a previous refactor.
- Raw modes UNIX systems improved     
- Added `NoItalic` attribute
2019-04-10 23:46:30 +02:00

49 lines
1.2 KiB
Rust

macro_rules! def_attr {
($name: ident => $attr: path) => {
fn $name(self) -> StyledObject<D> {
let so = self;
so.attr($attr)
}
};
}
macro_rules! def_color {
($side:ident: $name: ident => $color: path) => {
fn $name(self) -> StyledObject<D> {
StyledObject {
object_style: ObjectStyle {
$side: Some($color),
.. self.object_style
},
.. self
}
}
};
}
macro_rules! def_str_color {
($side:ident: $name: ident => $color: path) => {
fn $name(self) -> StyledObject< &'static str> {
StyledObject {
object_style: ObjectStyle {
$side: Some($color),
.. ObjectStyle::default()
},
content: self
}
}
};
}
macro_rules! def_str_attr {
($name: ident => $color: path) => {
fn $name(self) -> StyledObject<&'static str> {
StyledObject {
object_style: ObjectStyle::default(),
content: self
}
}
}
}