mirror of
https://github.com/ratatui-org/ratatui
synced 2025-02-18 06:58:51 +00:00
Mark Style::* functions const
This commit is contained in:
parent
d16db5ed90
commit
808a5c9ffd
1 changed files with 9 additions and 6 deletions
15
src/style.rs
15
src/style.rs
|
@ -114,30 +114,33 @@ pub struct Style {
|
||||||
|
|
||||||
impl Default for Style {
|
impl Default for Style {
|
||||||
fn default() -> Style {
|
fn default() -> Style {
|
||||||
|
Style::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Style {
|
||||||
|
pub const fn new() -> Self {
|
||||||
Style {
|
Style {
|
||||||
fg: Color::Reset,
|
fg: Color::Reset,
|
||||||
bg: Color::Reset,
|
bg: Color::Reset,
|
||||||
modifier: Modifier::empty(),
|
modifier: Modifier::empty(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
impl Style {
|
|
||||||
pub fn reset(&mut self) {
|
pub fn reset(&mut self) {
|
||||||
self.fg = Color::Reset;
|
self.fg = Color::Reset;
|
||||||
self.bg = Color::Reset;
|
self.bg = Color::Reset;
|
||||||
self.modifier = Modifier::empty();
|
self.modifier = Modifier::empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn fg(mut self, color: Color) -> Style {
|
pub const fn fg(mut self, color: Color) -> Style {
|
||||||
self.fg = color;
|
self.fg = color;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
pub fn bg(mut self, color: Color) -> Style {
|
pub const fn bg(mut self, color: Color) -> Style {
|
||||||
self.bg = color;
|
self.bg = color;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
pub fn modifier(mut self, modifier: Modifier) -> Style {
|
pub const fn modifier(mut self, modifier: Modifier) -> Style {
|
||||||
self.modifier = modifier;
|
self.modifier = modifier;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue