pub trait ForgeJob:
Sealed
+ Send
+ Sync
+ 'static {
type Args: DeserializeOwned + Serialize + Send + Sync;
type Output: Serialize + Send;
// Required methods
fn info() -> JobInfo;
fn execute(
ctx: &JobContext,
args: Self::Args,
) -> Pin<Box<dyn Future<Output = Result<Self::Output>> + Send + '_>>;
// Provided method
fn compensate<'a>(
_ctx: &'a JobContext,
_args: Self::Args,
_reason: &'a str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>> { ... }
}Expand description
Trait for background job handlers.
Required Associated Types§
Required Methods§
fn info() -> JobInfo
fn execute( ctx: &JobContext, args: Self::Args, ) -> Pin<Box<dyn Future<Output = Result<Self::Output>> + Send + '_>>
Provided Methods§
fn compensate<'a>( _ctx: &'a JobContext, _args: Self::Args, _reason: &'a str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>>
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.