aboutsummaryrefslogtreecommitdiff
path: root/azalea-chat/src/base_component.rs
blob: dcc28ecc7522154177ea51ced0190a8f84c30e50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use crate::{style::Style, FormattedText};
use serde::Serialize;

#[derive(Clone, Debug, PartialEq, Serialize, Eq, Hash)]
pub struct BaseComponent {
    // implements mutablecomponent
    #[serde(skip_serializing_if = "Vec::is_empty")]
    pub siblings: Vec<FormattedText>,
    #[serde(flatten)]
    pub style: Style,
}

impl BaseComponent {
    pub fn new() -> Self {
        Self {
            siblings: Vec::new(),
            style: Style::default(),
        }
    }
}

impl Default for BaseComponent {
    fn default() -> Self {
        Self::new()
    }
}