godoru 0.1.0

UI Framework for Rust using Godot
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum ContainerDirection {
    Vertical,
    Horizontal,
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub enum ContainerWrap {
    NoWrap,
    Wrap,
    WrapReverse,
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub enum Align {
    Start,
    Center,
    End,
    Stretch,
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub enum Justify {
    Start,
    Center,
    End,
    SpaceBetween,
    SpaceAround,
    SpaceEvenly,
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub enum SizeMode {
    Fit,
    Fill,
    Fixed(u32),
    Percent(u8),
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Spacing {
    pub left: u32,
    pub top: u32,
    pub right: u32,
    pub bottom: u32,
}

impl Spacing {
    pub fn all(value: u32) -> Self {
        Self {
            left: value,
            top: value,
            right: value,
            bottom: value,
        }
    }

    pub fn xy(x: u32, y: u32) -> Self {
        Self {
            left: x,
            top: y,
            right: x,
            bottom: y,
        }
    }

    pub fn sides(top: u32, right: u32, bottom: u32, left: u32) -> Self {
        Self {
            left,
            top,
            right,
            bottom,
        }
    }

    pub fn top(mut self, value: u32) -> Self {
        self.top = value;
        self
    }

    pub fn right(mut self, value: u32) -> Self {
        self.right = value;
        self
    }

    pub fn bottom(mut self, value: u32) -> Self {
        self.bottom = value;
        self
    }

    pub fn left(mut self, value: u32) -> Self {
        self.left = value;
        self
    }
}

impl Default for Spacing {
    fn default() -> Self {
        Self::all(0)
    }
}

pub trait IntoSpacing {
    fn intoSpacing(self) -> Spacing;
}

impl IntoSpacing for Spacing {
    fn intoSpacing(self) -> Spacing {
        self
    }
}

impl IntoSpacing for u32 {
    fn intoSpacing(self) -> Spacing {
        Spacing::all(self)
    }
}

impl IntoSpacing for (u32, u32, u32, u32) {
    fn intoSpacing(self) -> Spacing {
        Spacing::sides(self.0, self.1, self.2, self.3)
    }
}