|
1 | | -//! This module contains Yew's web worker implementation. |
2 | | -//! |
3 | | -//! ## Types |
4 | | -//! |
5 | | -//! There're a couple kinds of agents: |
6 | | -//! |
7 | | -//! #### Oneshot |
8 | | -//! |
9 | | -//! A kind of agent that for each input, a single output is returned. |
10 | | -//! |
11 | | -//! #### Reactor |
12 | | -//! |
13 | | -//! A kind of agent that can send many inputs and receive many outputs over a single bridge. |
14 | | -//! |
15 | | -//! #### Worker |
16 | | -//! |
17 | | -//! The low-level implementation of agents that provides an actor model and communicates with |
18 | | -//! multiple bridges. |
19 | | -//! |
20 | | -//! ## Reachability |
21 | | -//! |
22 | | -//! When an agent is spawned, each agent is associated with a reachability. |
23 | | -//! |
24 | | -//! #### Private |
25 | | -//! |
26 | | -//! Each time a bridge is created, a new instance |
27 | | -//! of agent is spawned. This allows parallel computing between agents. |
28 | | -//! |
29 | | -//! #### Public |
30 | | -//! |
31 | | -//! Public agents are shared among all children of a provider. |
32 | | -//! Only 1 instance will be spawned for each public agents provider. |
33 | | -//! |
34 | | -//! ### Provider |
35 | | -//! |
36 | | -//! Each Agent requires a provider to provide communications and maintain bridges. |
37 | | -//! All hooks must be called within a provider. |
38 | | -//! |
39 | | -//! ## Communications with Agents |
40 | | -//! |
41 | | -//! Hooks provides means to communicate with agent instances. |
42 | | -//! |
43 | | -//! #### Bridge |
44 | | -//! |
45 | | -//! See: [`use_worker_bridge`](worker::use_worker_bridge), |
46 | | -//! [`use_reactor_bridge`](reactor::use_reactor_bridge) |
47 | | -//! |
48 | | -//! A bridge takes a callback to receive outputs from agents |
49 | | -//! and provides a handle to send inputs to agents. |
50 | | -//! |
51 | | -//! #### Subscription |
52 | | -//! |
53 | | -//! See: [`use_worker_subscription`](worker::use_worker_subscription), |
54 | | -//! [`use_reactor_subscription`](reactor::use_reactor_subscription) |
55 | | -//! |
56 | | -//! Similar to bridges, a subscription produces a handle to send inputs to agents. However, instead |
57 | | -//! of notifying the receiver with a callback, it collect all outputs into a slice. |
58 | | -//! |
59 | | -//! #### Runner |
60 | | -//! |
61 | | -//! See: [`use_oneshot_runner`](oneshot::use_oneshot_runner) |
62 | | -//! |
63 | | -//! Unlike other agents, oneshot bridges provide a `use_oneshot_runner` hook to execute oneshot |
64 | | -//! agents on demand. |
65 | | -
|
| 1 | +#![doc = include_str!("../README.md")] |
66 | 2 | #![deny( |
67 | 3 | clippy::all, |
68 | 4 | missing_docs, |
|
74 | 10 |
|
75 | 11 | extern crate self as yew_agent; |
76 | 12 |
|
| 13 | +pub mod codec; |
77 | 14 | pub mod oneshot; |
78 | 15 | pub mod reactor; |
79 | 16 | pub mod worker; |
80 | | - |
81 | | -#[doc(inline)] |
82 | | -pub use gloo_worker::{Bincode, Codec, Registrable, Spawnable}; |
| 17 | +pub use codec::{Bincode, Codec}; |
| 18 | +pub mod traits; |
| 19 | +pub use traits::{Registrable, Spawnable}; |
83 | 20 |
|
84 | 21 | mod reach; |
85 | 22 | pub mod scope_ext; |
|
0 commit comments