summaryrefslogtreecommitdiffstats
path: root/src/component.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/component.rs')
-rw-r--r--src/component.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/component.rs b/src/component.rs
index 32dab6d..6706268 100644
--- a/src/component.rs
+++ b/src/component.rs
@@ -39,7 +39,9 @@ pub trait Component: Send + 'static {
type Updater: Update;
type Colorer: Update;
type Handler: Button;
+}
+pub trait Runner: Component + private::Sealed {
fn run<R: Read + Send>(reader: R) -> impl Future<Output = Result<(), Error>> + Send {
async move {
use std::io::BufRead;
@@ -139,6 +141,14 @@ pub trait Component: Send + 'static {
}
}
+impl<T: Component> Runner for T {}
+
+mod private {
+ pub trait Sealed {}
+
+ impl<T: super::Component> Sealed for T {}
+}
+
pub trait Update: Send + 'static {
type Value: Send;