pub struct SystemBuilder { /* private fields */ }Expand description
A builder for system definitions.
§Examples
use async_flow::model::SystemBuilder;
let mut builder = SystemBuilder::new();
//let block = builder.register(MyBlock::new());
let system = builder.build();Implementations§
Source§impl SystemBuilder
impl SystemBuilder
Sourcepub fn register<T: BlockDefinition + 'static>(&mut self, block: T) -> Rc<T>
pub fn register<T: BlockDefinition + 'static>(&mut self, block: T) -> Rc<T>
Registers an instantiated block with the system under construction.
Sourcepub fn register_port(&mut self, input: impl Into<PortId>)
pub fn register_port(&mut self, input: impl Into<PortId>)
Registers an input or output port with the system under construction.
Sourcepub fn register_input(&mut self, input: impl Into<InputPortId>)
pub fn register_input(&mut self, input: impl Into<InputPortId>)
Registers an input port with the system under construction.
Sourcepub fn register_output(&mut self, output: impl Into<OutputPortId>)
pub fn register_output(&mut self, output: impl Into<OutputPortId>)
Registers an output port with the system under construction.
Sourcepub fn export(
&mut self,
input: impl Into<PortId>,
) -> Result<PortId, SystemBuildError>
pub fn export( &mut self, input: impl Into<PortId>, ) -> Result<PortId, SystemBuildError>
Exports an input or output port registered with the system under construction.
Sourcepub fn export_port(
&mut self,
input: impl Into<PortId>,
) -> Result<PortId, SystemBuildError>
pub fn export_port( &mut self, input: impl Into<PortId>, ) -> Result<PortId, SystemBuildError>
Exports an input or output port registered with the system under construction.
Sourcepub fn export_input(
&mut self,
input: impl Into<InputPortId>,
) -> Result<InputPortId, SystemBuildError>
pub fn export_input( &mut self, input: impl Into<InputPortId>, ) -> Result<InputPortId, SystemBuildError>
Exports an input port registered with the system under construction.
Sourcepub fn export_output(
&mut self,
output: impl Into<OutputPortId>,
) -> Result<OutputPortId, SystemBuildError>
pub fn export_output( &mut self, output: impl Into<OutputPortId>, ) -> Result<OutputPortId, SystemBuildError>
Exports an output port registered with the system under construction.
Sourcepub fn connect<T>(
&mut self,
output: &Outputs<T>,
input: &Inputs<T>,
) -> Result<bool, SystemBuildError>
pub fn connect<T>( &mut self, output: &Outputs<T>, input: &Inputs<T>, ) -> Result<bool, SystemBuildError>
Connects an output port to an input port of the same type.
Returns a boolean indicating whether the connection was newly inserted or already existed.
Sourcepub fn build(self) -> SystemDefinition
pub fn build(self) -> SystemDefinition
Builds the system under construction.
Trait Implementations§
Source§impl Clone for SystemBuilder
impl Clone for SystemBuilder
Source§fn clone(&self) -> SystemBuilder
fn clone(&self) -> SystemBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more