pub trait Operator<NetworkItem>:
Debug
+ Named
+ Send
+ Sync{
// Required methods
fn opcode(&self) -> Arc<dyn OpCode>;
fn input_count(&self) -> usize;
fn output_count(&self) -> usize;
fn input_port_type_str(&self, port: usize) -> Option<&'static str>;
fn output_port_type_str(&self, port: usize) -> Option<&'static str>;
fn input_port_connection_required(&self, port: usize) -> bool;
fn output_port_connection_required(&self, port: usize) -> bool;
fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
input: [Option<&'life1 NetworkItem>; 4],
output: &'life2 mut [Option<NetworkItem>; 4],
) -> Pin<Box<dyn Future<Output = NetResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
A trait that describes a single operator within the network. Each operator is responsible for processing input buffers to produce output buffers.
Required Methods§
Sourcefn opcode(&self) -> Arc<dyn OpCode>
fn opcode(&self) -> Arc<dyn OpCode>
Returns the operation code, which can be used to inform specialized handling or diagnostics.
Sourcefn input_count(&self) -> usize
fn input_count(&self) -> usize
How many actual inputs does this operator need?
Sourcefn output_count(&self) -> usize
fn output_count(&self) -> usize
How many outputs does this operator produce?
Sourcefn input_port_type_str(&self, port: usize) -> Option<&'static str>
fn input_port_type_str(&self, port: usize) -> Option<&'static str>
used by the network! dag compiler to verify that the input port of one operator is compatible with the data flowing into it from the output port of another operator
Sourcefn output_port_type_str(&self, port: usize) -> Option<&'static str>
fn output_port_type_str(&self, port: usize) -> Option<&'static str>
used by the network! dag compiler to verify that the output port of one operator is compatible with the data required by the input port of its downstream operator
Sourcefn input_port_connection_required(&self, port: usize) -> bool
fn input_port_connection_required(&self, port: usize) -> bool
used by the network! dag compiler to verify that this input port needs an output connection
Sourcefn output_port_connection_required(&self, port: usize) -> bool
fn output_port_connection_required(&self, port: usize) -> bool
used by the network! dag compiler to verify that this output port needs an input connection
Sourcefn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
input: [Option<&'life1 NetworkItem>; 4],
output: &'life2 mut [Option<NetworkItem>; 4],
) -> Pin<Box<dyn Future<Output = NetResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
input: [Option<&'life1 NetworkItem>; 4],
output: &'life2 mut [Option<NetworkItem>; 4],
) -> Pin<Box<dyn Future<Output = NetResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
The big 4×4 method: You receive up to 4 inputs and must fill up to 4 outputs.