pub(crate) async fn invoke_capability(
    middlewares: &[Box<dyn Middleware>],
    inv: Invocation,
    target: Recipient<Invocation>,
) -> Result<InvocationResponse> {
    // PRE
    if let Err(e) = run_capability_pre_invoke(&inv, &middlewares) {
        error!("Middleware pre-invoke failure: {}", e);
        return Err(e);
    } else {
        match target.send(inv.clone()).await {
            Ok(ir) => {
                // POST
                run_capability_post_invoke(ir, middlewares)
            }
            Err(_e) => Err("Actor mailbox failure during middleware execution".into()),
        }
    }
}
/// Execute a full chain of middleware, terminating at a capability provider
Execute a full chain of middleware, terminating at a capability provider
Execute a full chain of middleware terminating at a capability provider
pub(crate) async fn invoke_capability(
    middlewares: &[Box<dyn Middleware>],
    inv: Invocation,
    target: Recipient<Invocation>,
) -> Result<InvocationResponse> {
    // PRE
    if let Err(e) = run_capability_pre_invoke(&inv, &middlewares) {
        error!("Middleware pre-invoke failure: {}", e);
        return Err(e);
    } else {
        match target.send(inv.clone()).await {
            Ok(ir) => {
                // POST
                run_capability_post_invoke(ir, middlewares)
            }
            Err(_e) => Err("Actor mailbox failure during middleware execution".into()),
        }
    }
}
pub ( crate ) async fn invoke_capability ( middlewares : & [ Box < dyn Middleware > ] , inv : Invocation , target : Recipient < Invocation > , ) -> Result < InvocationResponse > { // PRE if let Err ( e ) = run_capability_pre_invoke ( & inv , & middlewares ) { error ! ( " " e ) ; return Err ( e ) ; } else { match target . send ( inv . clone ( ) ) . await { Ok ( ir ) => { // POST run_capability_post_invoke ( ir , middlewares ) } Err ( _e ) => Err ( " " . into ( ) ) , } } }
Execute a full chain of middleware, terminating at a capability provider
Execute a full chain of middleware terminating at a capability provider
middlewares
&[Box<dyn Middleware>]
inv
Invocation
target
Recipient<Invocation>
middlewares
&[Box<dyn Middleware>]
inv
Invocation
target
Recipient<Invocation>