pub trait Dispatchable:
Serialize
+ Send
+ Sync {
// Required method
fn job_name() -> &'static str;
// Provided methods
fn dispatch<'life0, 'life1, 'async_trait>(
&'life0 self,
req: &'life1 Request,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait { ... }
fn dispatch_queue<'life0, 'life1, 'async_trait>(
&'life0 self,
queue: &'life1 QueueManager,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait { ... }
}Expand description
Trait yang memungkinkan pemanggilan job secara fluen: MyJob { ... }.dispatch(&req).await?
Required Methods§
Provided Methods§
Sourcefn dispatch<'life0, 'life1, 'async_trait>(
&'life0 self,
req: &'life1 Request,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn dispatch<'life0, 'life1, 'async_trait>(
&'life0 self,
req: &'life1 Request,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Kirim job ke antrean latar belakang via Request bundle
Sourcefn dispatch_queue<'life0, 'life1, 'async_trait>(
&'life0 self,
queue: &'life1 QueueManager,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn dispatch_queue<'life0, 'life1, 'async_trait>(
&'life0 self,
queue: &'life1 QueueManager,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Kirim job ke antrean latar belakang menggunakan QueueManager langsung
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".