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
// Copyright 2021-2022 Aaron Erhardt <aaron.erhardt@t-online.de>
// Copyright 2022 System76 <info@system76.com>
// SPDX-License-Identifier: MIT or Apache-2.0

mod builder;
mod connector;
mod controller;
mod message_broker;
mod state_watcher;
mod stream;
mod traits;

pub use builder::ComponentBuilder;
pub use connector::Connector;
pub use controller::{ComponentController, Controller};
pub use message_broker::MessageBroker;
pub use state_watcher::StateWatcher;
pub use stream::ComponentStream;
pub use traits::{Component, SimpleComponent};

use std::future::Future;
use std::pin::Pin;

/// A future returned by a component's command method.
pub type CommandFuture = Pin<Box<dyn Future<Output = ()> + Send>>;

/// Contains the initial model and widgets being docked into a component.
#[derive(Debug)]
pub struct ComponentParts<C: Component> {
    /// The model of the component.
    pub model: C,
    /// The widgets created for the view.
    pub widgets: C::Widgets,
}