ipaacar_core/components/buffer/
mod.rs

1use crate::backend::Backend;
2use crate::components::buffer::input::InputBuffer;
3use crate::components::buffer::output::OutputBuffer;
4use std::error::Error;
5
6pub(crate) mod buffer_iu_cb_manager;
7pub mod input;
8pub mod output;
9
10/// Creates an Input-/OutputBuffer pair. Both of them will belong to the same component but still
11/// use separate Backend connections.
12pub async fn create_pair<B: Backend + Send + Sync + 'static>(
13    input_uid: impl Into<String> + Send,
14    output_uid: impl Into<String> + Send,
15    component_name: impl Into<String> + Send + Clone,
16    address: impl Into<String> + Send + Clone,
17    backend_config: Option<B::Config>,
18) -> Result<(InputBuffer<B>, OutputBuffer<B>), Box<dyn Error + Sync + Send>> {
19    let ib = InputBuffer::new(input_uid, component_name.clone(), address.clone(), backend_config.clone()).await?;
20    let ob = OutputBuffer::new(output_uid, component_name, address, backend_config.clone()).await?;
21    Ok((ib, ob))
22}