pub trait Axon<T, C>: Send + Sync{
// Required methods
fn react(
&mut self,
reactants: Vec<Box<dyn Reactant<T, C> + Send + Sync + 'static>>,
) -> Pin<Box<dyn Future<Output = Result<(), AxonError>> + Send + '_>>;
fn transmit(
&mut self,
data: T,
) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>>;
fn transmit_with_trace(
&mut self,
data: T,
trace_context: TraceContext,
) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>>;
fn transmit_erased(
&mut self,
data: T,
) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>>;
fn transmit_erased_with_trace(
&mut self,
data: T,
trace_context: TraceContext,
) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>>;
fn neuron_name(&self) -> String;
// Provided methods
fn transmit_with_timeout(
&mut self,
data: T,
timeout_duration: Duration,
) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>> { ... }
fn transmit_with_trace_with_timeout(
&mut self,
data: T,
trace_context: TraceContext,
timeout_duration: Duration,
) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>> { ... }
fn transmit_batch(
&mut self,
data_items: Vec<T>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<()>>, AxonError>> + Send + '_>> { ... }
fn transmit_batch_with_trace(
&mut self,
data_items: Vec<T>,
trace_context: TraceContext,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<()>>, AxonError>> + Send + '_>> { ... }
fn is_ready(&self) -> bool { ... }
fn status(&self) -> String { ... }
}Expand description
Trait for axon operations with typed neurons and data
Required Methods§
Sourcefn react(
&mut self,
reactants: Vec<Box<dyn Reactant<T, C> + Send + Sync + 'static>>,
) -> Pin<Box<dyn Future<Output = Result<(), AxonError>> + Send + '_>>
fn react( &mut self, reactants: Vec<Box<dyn Reactant<T, C> + Send + Sync + 'static>>, ) -> Pin<Box<dyn Future<Output = Result<(), AxonError>> + Send + '_>>
React to incoming reactants using the neuron
Sourcefn transmit(
&mut self,
data: T,
) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>>
fn transmit( &mut self, data: T, ) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>>
Transmit data through the neuron and ganglion
Sourcefn transmit_with_trace(
&mut self,
data: T,
trace_context: TraceContext,
) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>>
fn transmit_with_trace( &mut self, data: T, trace_context: TraceContext, ) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>>
Transmit data with explicit tracing context.
Sourcefn transmit_erased(
&mut self,
data: T,
) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>>
fn transmit_erased( &mut self, data: T, ) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>>
Transmit data through the neuron and ganglion using type erasure
Sourcefn transmit_erased_with_trace(
&mut self,
data: T,
trace_context: TraceContext,
) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>>
fn transmit_erased_with_trace( &mut self, data: T, trace_context: TraceContext, ) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>>
Transmit data using type erasure with explicit tracing context.
Sourcefn neuron_name(&self) -> String
fn neuron_name(&self) -> String
Get the neuron name
Provided Methods§
Sourcefn transmit_with_timeout(
&mut self,
data: T,
timeout_duration: Duration,
) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>>
fn transmit_with_timeout( &mut self, data: T, timeout_duration: Duration, ) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>>
Transmit data with a timeout
Sourcefn transmit_with_trace_with_timeout(
&mut self,
data: T,
trace_context: TraceContext,
timeout_duration: Duration,
) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>>
fn transmit_with_trace_with_timeout( &mut self, data: T, trace_context: TraceContext, timeout_duration: Duration, ) -> Pin<Box<dyn Future<Output = Result<Vec<()>, AxonError>> + Send + '_>>
Transmit data with a trace and timeout
Sourcefn transmit_batch(
&mut self,
data_items: Vec<T>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<()>>, AxonError>> + Send + '_>>
fn transmit_batch( &mut self, data_items: Vec<T>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<()>>, AxonError>> + Send + '_>>
Transmit multiple data items in batch