logic_mesh/base/input/
mod.rs

1// Copyright (c) 2022-2023, Radu Racariu.
2
3//!
4//! Defines the block input trait
5//!
6
7use std::pin::Pin;
8
9use futures::Future;
10use libhaystack::val::Value;
11
12pub mod base;
13pub mod input_reader;
14pub mod props;
15
16pub use base::BaseInput;
17pub use props::{InputDefault, InputProps};
18
19/// Type used to describe the receiver of an Input
20pub trait InputReceiver = Future<Output = Option<Value>> + Send;
21
22/// The input trait
23pub trait Input: InputProps {
24    /// Gets this input receiver which can be polled for data.
25    fn receiver(&mut self) -> Pin<Box<dyn InputReceiver + '_>>;
26
27    /// Sets this input value
28    fn set_value(&mut self, value: Value);
29}