ForgeAction

Trait ForgeAction 

Source
pub trait ForgeAction:
    Send
    + Sync
    + 'static {
    type Args: DeserializeOwned + Serialize + Send + Sync;
    type Output: Serialize + Send;

    // Required methods
    fn info() -> FunctionInfo;
    fn execute(
        ctx: &ActionContext,
        args: Self::Args,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Output>> + Send + '_>>;
}
Expand description

An action function (side effects, external APIs).

Actions:

  • Can call external APIs
  • Are NOT transactional by default
  • Can call queries and mutations
  • May be slow (external network calls)
  • Can have timeouts and retries

Required Associated Types§

Source

type Args: DeserializeOwned + Serialize + Send + Sync

The input arguments type.

Source

type Output: Serialize + Send

The output type.

Required Methods§

Source

fn info() -> FunctionInfo

Function metadata.

Source

fn execute( ctx: &ActionContext, args: Self::Args, ) -> Pin<Box<dyn Future<Output = Result<Self::Output>> + Send + '_>>

Execute the action.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§