aboutsummaryrefslogtreecommitdiff
path: root/azalea-chat/src/base_component.rs
blob: 43b35aef67ea7d5cc56daa0c5fe799171de40c52 (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)]
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()
    }
}