forked from ROMEO/nexosim
Implement Default for ReplierAdaptor
This commit is contained in:
parent
0274e62eb0
commit
97c855293d
@ -13,11 +13,7 @@ use nexosim::ports::{Output, Requestor};
|
|||||||
///
|
///
|
||||||
/// Model input is propagated to all the connected replier ports and their
|
/// Model input is propagated to all the connected replier ports and their
|
||||||
/// answers are written to the model output.
|
/// answers are written to the model output.
|
||||||
pub struct ReplierAdaptor<T, R>
|
pub struct ReplierAdaptor<T: Clone + Send + 'static, R: Clone + Send + 'static> {
|
||||||
where
|
|
||||||
T: Clone + Send + 'static,
|
|
||||||
R: Clone + Send + 'static,
|
|
||||||
{
|
|
||||||
/// Requestor port to be connected to replier port.
|
/// Requestor port to be connected to replier port.
|
||||||
pub requestor: Requestor<T, R>,
|
pub requestor: Requestor<T, R>,
|
||||||
|
|
||||||
@ -25,17 +21,10 @@ where
|
|||||||
pub output: Output<R>,
|
pub output: Output<R>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T, R> ReplierAdaptor<T, R>
|
impl<T: Clone + Send + 'static, R: Clone + Send + 'static> ReplierAdaptor<T, R> {
|
||||||
where
|
|
||||||
T: Clone + Send + 'static,
|
|
||||||
R: Clone + Send + 'static,
|
|
||||||
{
|
|
||||||
/// Creates a `ReplierAdaptor` model.
|
/// Creates a `ReplierAdaptor` model.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self::default()
|
||||||
requestor: Requestor::new(),
|
|
||||||
output: Output::new(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Input port.
|
/// Input port.
|
||||||
@ -46,9 +35,13 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T, R> Model for ReplierAdaptor<T, R>
|
impl<T: Clone + Send + 'static, R: Clone + Send + 'static> Model for ReplierAdaptor<T, R> {}
|
||||||
where
|
|
||||||
T: Clone + Send + 'static,
|
impl<T: Clone + Send + 'static, R: Clone + Send + 'static> Default for ReplierAdaptor<T, R> {
|
||||||
R: Clone + Send + 'static,
|
fn default() -> Self {
|
||||||
{
|
Self {
|
||||||
|
requestor: Requestor::new(),
|
||||||
|
output: Output::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user