1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! Worker System for RustF
//!
//! Provides a lightweight worker manager with a Total.js-inspired global API.
//! Workers are registered once and can be started on demand from anywhere in
//! the application. Each execution runs to completion and stops automatically,
//! while the messaging channel enables coordination between the worker and the
//! main application.
//!
//! # Example Usage
//!
//! ```rust,ignore
//! // During startup
//! WORKER::register("send-email", |ctx| async move {
//! ctx.info("Sending email...");
//! Ok(())
//! }).await?;
//!
//! // Later in the application
//! let mut handle = WORKER::call("send-email", None, Some(json!({"to":"user@example.com"}))).await?;
//! handle.await_result().await?;
//! ```
// Re-export main types for public API
pub use WORKER;
pub use WorkerContext;
pub use ;
pub use ;
pub use ;
use crateResult;
use Arc;
/// Initialize the worker system
///
/// This function is called during RustF application startup to initialize
/// the global worker registry and manager.
/// Initialize with a specific manager
/// Shutdown the worker system gracefully
///
/// This function is called during RustF application shutdown to stop all
/// workers and clean up resources.
pub async