Derive PartialEq

This commit is contained in:
Gilad Woloch 2021-10-06 12:27:51 +03:00 committed by Arijit Basu
parent 46287f6373
commit 2ef7523bb0

View File

@ -206,7 +206,7 @@ impl Modifier {
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[derive(Debug, PartialEq, Clone, Default, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Style {
pub fg: Option<Color>,
@ -215,15 +215,6 @@ pub struct Style {
pub sub_modifiers: Option<IndexSet<Modifier>>,
}
impl PartialEq for Style {
fn eq(&self, other: &Self) -> bool {
self.fg == other.fg
&& self.bg == other.bg
&& self.add_modifiers == other.add_modifiers
&& self.sub_modifiers == other.sub_modifiers
}
}
impl Style {
pub fn extend(mut self, other: &Self) -> Self {
self.fg = other.fg.or(self.fg);