kkx/kkdisp/src/component.rs

44 lines
1.0 KiB
Rust

use crate::theme::{Color, ColorSet};
#[derive(Eq, Debug, Clone)]
pub enum Component {
X(usize),
String(String),
Clear(Clear),
Fg(Color),
Bg(Color),
}
impl PartialEq for Component {
fn eq(&self, other: &Self) -> bool {
match self {
Self::X(x) => match other {
Self::X(other_x) => x == other_x,
_ => false,
},
Self::String(s) => match other {
Self::String(other_s) => s == other_s,
_ => false,
},
Self::Clear(clr) => match other {
Self::Clear(other_clr) => clr == other_clr,
_ => false,
},
Self::Fg(c) => match other {
Self::Fg(other_c) => c == other_c,
_ => false,
},
Self::Bg(c) => match other {
Self::Bg(other_c) => c == other_c,
_ => false,
},
}
}
}
#[derive(PartialEq, Debug, Clone, Copy, Eq)]
pub enum Clear {
Line,
Screen,
}