Trait ockam::pipe::BehaviorHook
source · [−]pub trait BehaviorHook: DynClone + Send {
fn on_external<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
this: Address,
peer: Route,
ctx: &'life1 mut Context,
msg: &'life2 PipeMessage
) -> Pin<Box<dyn Future<Output = Result<PipeModifier>> + Send + 'async_trait>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
fn on_internal<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
this: Address,
peer: Route,
ctx: &'life1 mut Context,
msg: &'life2 InternalCmd
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
}
Expand description
Define the behavior of a pipe
Required Methods
fn on_external<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
this: Address,
peer: Route,
ctx: &'life1 mut Context,
msg: &'life2 PipeMessage
) -> Pin<Box<dyn Future<Output = Result<PipeModifier>> + Send + 'async_trait>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn on_external<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
this: Address,
peer: Route,
ctx: &'life1 mut Context,
msg: &'life2 PipeMessage
) -> Pin<Box<dyn Future<Output = Result<PipeModifier>> + Send + 'async_trait>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
This function MUST be run for every incoming user message
- Access to mutable self
- Access to own internal address
- Access to peer internal route
- Access to mutable context
- Access to incoming or outgoing PipeMessage
fn on_internal<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
this: Address,
peer: Route,
ctx: &'life1 mut Context,
msg: &'life2 InternalCmd
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn on_internal<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
this: Address,
peer: Route,
ctx: &'life1 mut Context,
msg: &'life2 InternalCmd
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
This function MUST be run for every incoming internal message
An internal message is one sent to the private API address of this worker to issue commands, such as re-sending payloads