Skip to content

Commit

Permalink
Implement Default for ReplierAdaptor
Browse files Browse the repository at this point in the history
  • Loading branch information
jauhien committed Dec 6, 2024
1 parent 0274e62 commit 97c8552
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions nexosim-util/src/combinators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,18 @@ use nexosim::ports::{Output, Requestor};
///
/// Model input is propagated to all the connected replier ports and their
/// answers are written to the model output.
pub struct ReplierAdaptor<T, R>
where
T: Clone + Send + 'static,
R: Clone + Send + 'static,
{
pub struct ReplierAdaptor<T: Clone + Send + 'static, R: Clone + Send + 'static> {
/// Requestor port to be connected to replier port.
pub requestor: Requestor<T, R>,

/// Output port to be connected to input port.
pub output: Output<R>,
}

impl<T, R> ReplierAdaptor<T, R>
where
T: Clone + Send + 'static,
R: Clone + Send + 'static,
{
impl<T: Clone + Send + 'static, R: Clone + Send + 'static> ReplierAdaptor<T, R> {
/// Creates a `ReplierAdaptor` model.
pub fn new() -> Self {
Self {
requestor: Requestor::new(),
output: Output::new(),
}
Self::default()
}

/// Input port.
Expand All @@ -46,9 +35,13 @@ where
}
}

impl<T, R> Model for ReplierAdaptor<T, R>
where
T: Clone + Send + 'static,
R: Clone + Send + 'static,
{
impl<T: Clone + Send + 'static, R: Clone + Send + 'static> Model for ReplierAdaptor<T, R> {}

impl<T: Clone + Send + 'static, R: Clone + Send + 'static> Default for ReplierAdaptor<T, R> {
fn default() -> Self {
Self {
requestor: Requestor::new(),
output: Output::new(),
}
}
}

0 comments on commit 97c8552

Please sign in to comment.