pub struct AxonImpl<T, C>{ /* private fields */ }Expand description
Implementation of Axon that stores a neuron and ganglion with type erasure handling
Implementations§
Source§impl<T, C> AxonImpl<T, C>
impl<T, C> AxonImpl<T, C>
Sourcepub fn new(
neuron: Arc<dyn Neuron<T, C> + Send + Sync + 'static>,
ganglion: Arc<Mutex<dyn GanglionInternal + Send + Sync + 'static>>,
) -> Self
pub fn new( neuron: Arc<dyn Neuron<T, C> + Send + Sync + 'static>, ganglion: Arc<Mutex<dyn GanglionInternal + Send + Sync + 'static>>, ) -> Self
Create a new AxonImpl with the given neuron and ganglion
Sourcepub fn builder() -> AxonBuilder<T, C>
pub fn builder() -> AxonBuilder<T, C>
Create a builder for constructing an AxonImpl
Sourcepub fn neuron(&self) -> &Arc<dyn Neuron<T, C> + Send + Sync + 'static>
pub fn neuron(&self) -> &Arc<dyn Neuron<T, C> + Send + Sync + 'static>
Get a reference to the underlying neuron
Sourcepub fn ganglion(
&self,
) -> &Arc<Mutex<dyn GanglionInternal + Send + Sync + 'static>>
pub fn ganglion( &self, ) -> &Arc<Mutex<dyn GanglionInternal + Send + Sync + 'static>>
Get a reference to the underlying ganglion
Sourcepub fn clone_neuron(&self) -> Arc<dyn Neuron<T, C> + Send + Sync + 'static>
pub fn clone_neuron(&self) -> Arc<dyn Neuron<T, C> + Send + Sync + 'static>
Clone the neuron for sharing
Sourcepub fn clone_ganglion(
&self,
) -> Arc<Mutex<dyn GanglionInternal + Send + Sync + 'static>>
pub fn clone_ganglion( &self, ) -> Arc<Mutex<dyn GanglionInternal + Send + Sync + 'static>>
Clone the ganglion for sharing
Sourcepub async fn ganglion_id(&self) -> Uuid
pub async fn ganglion_id(&self) -> Uuid
Get the unique ID of the underlying ganglion
Trait Implementations§
Source§impl<T, C> Axon<T, C> for AxonImpl<T, C>
impl<T, C> Axon<T, C> for AxonImpl<T, C>
Source§fn 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
Source§fn 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
Source§fn 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.
Source§fn 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
Source§fn 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.
Source§fn neuron_name(&self) -> String
fn neuron_name(&self) -> String
Get the neuron name
Source§fn 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
Source§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_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
Source§fn 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
Auto Trait Implementations§
impl<T, C> Freeze for AxonImpl<T, C>
impl<T, C> !RefUnwindSafe for AxonImpl<T, C>
impl<T, C> Send for AxonImpl<T, C>
impl<T, C> Sync for AxonImpl<T, C>
impl<T, C> Unpin for AxonImpl<T, C>
impl<T, C> !UnwindSafe for AxonImpl<T, C>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more