aboutsummaryrefslogtreecommitdiff
path: root/azalea-chat/src/base_component.rs
blob: ab4f5e5da945895d0780e6b5a6b0e7281d194f6e (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, Component};
use serde::Serialize;

#[derive(Clone, Debug, PartialEq, Serialize)]
pub struct BaseComponent {
    // implements mutablecomponent
    #[serde(skip_serializing_if = "Vec::is_empty")]
    pub siblings: Vec<Component>,
    #[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()
    }
}