Commit d55e2f8
cleanup(turbopack): Embed Global vs Specific channel type in the Rust type system (#79291)
## Refactor CompilationEventQueue to use enum for event channel types
### What?
Introduces a new `EventChannelType` enum to replace string-based event
channel identification in the `CompilationEventQueue`.
### Why?
This change improves type safety by replacing string-based channel
identification with a proper enum. Using an enum instead of string
literals makes the code more robust and more self-evident in what it's
trying to accomplish.
### How?
- Created a new `EventChannelType` enum with two variants: `Global` and
`Type(String)`
- Updated the `subscribers` map to use `EventChannelType` as keys
instead of strings
- Replaced string literals like `"*"` with the appropriate enum variant
(`EventChannelType::Global`)
- Modified the event subscription and publishing logic to work with the
new enum-based approach
---------
Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>1 parent 9ba8c16 commit d55e2f8
1 file changed
+20
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
18 | 24 | | |
19 | 25 | | |
20 | | - | |
| 26 | + | |
21 | 27 | | |
22 | 28 | | |
23 | 29 | | |
24 | 30 | | |
25 | 31 | | |
26 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
27 | 36 | | |
28 | 37 | | |
29 | 38 | | |
| |||
51 | 60 | | |
52 | 61 | | |
53 | 62 | | |
54 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
55 | 66 | | |
56 | 67 | | |
57 | 68 | | |
| |||
65 | 76 | | |
66 | 77 | | |
67 | 78 | | |
68 | | - | |
| 79 | + | |
69 | 80 | | |
70 | 81 | | |
71 | 82 | | |
| |||
95 | 106 | | |
96 | 107 | | |
97 | 108 | | |
98 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
99 | 112 | | |
100 | 113 | | |
101 | 114 | | |
| |||
105 | 118 | | |
106 | 119 | | |
107 | 120 | | |
108 | | - | |
| 121 | + | |
| 122 | + | |
109 | 123 | | |
110 | 124 | | |
111 | 125 | | |
| |||
0 commit comments