summaryrefslogtreecommitdiffstats
path: root/web/src/widget/row.rs
blob: fc474ec3a67f5fb46b73cd57de8ba8d42b354244 (plain) (blame)
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
27
28
29
30
31
32
33
34
35
36
use crate::{Element, Widget};

pub struct Row<'a, Message> {
    children: Vec<Element<'a, Message>>,
}

impl<'a, Message> Row<'a, Message> {
    pub fn new() -> Self {
        Self {
            children: Vec::new(),
        }
    }

    pub fn spacing(self, _spacing: u16) -> Self {
        self
    }

    pub fn push<E>(mut self, element: E) -> Self
    where
        E: Into<Element<'a, Message>>,
    {
        self.children.push(element.into());
        self
    }
}

impl<'a, Message> Widget<Message> for Row<'a, Message> {}

impl<'a, Message> From<Row<'a, Message>> for Element<'a, Message>
where
    Message: 'static,
{
    fn from(column: Row<'a, Message>) -> Element<'a, Message> {
        Element::new(column)
    }
}