You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here is a checklist of some general design principles that Gloo crates and APIs
141
+
should follow:
142
+
143
+
*[ ] Crate's public interface follows the [Rust API Guidelines][api-guidelines].
113
144
114
145
*[ ] Callback-taking APIs are generic over `F: Fn(A) -> B` (or `FnMut` or
115
146
`FnOnce`) instead of taking `wasm_bindgen::Closure`s or
116
147
`js_sys::Function`s directly.
117
148
118
-
*[ ] If the API can be implemented as a Future / Stream, then it should first be implemented as a callback, with the callback API put into the `callback` submodule.
149
+
*[ ] If the API can be implemented as a Future / Stream, then it should first
150
+
be implemented as a callback, with the callback API put into the
151
+
`callback` submodule.
119
152
120
-
Then the Future / Stream should be implemented using the callback API, and should be put into the `future` or `stream` submodule.
153
+
Then the Future / Stream should be implemented using the callback API, and
154
+
should be put into the `future` or `stream` submodule.
121
155
122
-
Make sure that the callback and Future / Stream APIs properly support cancellation (if it is possible to do so).
156
+
Make sure that the callback and Future / Stream APIs properly support
157
+
cancellation (if it is possible to do so).
123
158
124
159
*[ ] Uses nice Rust-y types and interfaces instead of passing around untyped
125
160
`JsValue`s.
@@ -129,32 +164,82 @@ Here is a checklist that all Gloo utility crates should fulfill:
129
164
escape hatch for dropping down to raw `web_sys` bindings when an API isn't
130
165
fully supported by the crate yet.
131
166
132
-
*[ ] There is a loose hierarchy with "mid-level" APIs (which are essentially thin wrappers over the low-level APIs), and "high-level" APIs (which make more substantial changes).
167
+
Similar for `from_raw` constructors and `into_raw` conversion methods when
168
+
applicable.
169
+
170
+
*[ ] There is a loose hierarchy with "mid-level" APIs (which are essentially
171
+
thin wrappers over the low-level APIs), and "high-level" APIs (which make
172
+
more substantial changes).
173
+
174
+
As a general rule, the high-level APIs should be built on top of the
175
+
mid-level APIs, which in turn should be built on top of the low-level APIs
176
+
(e.g. `web_sys`)
133
177
134
-
As a general rule, the high-level APIs should be built on top of the mid-level APIs, which in turn should be built on top of the low-level APIs (e.g. `web_sys`)
135
-
136
-
There are exceptions to this, but they have to be carefully decided on a case-by-case basis.
178
+
There are exceptions to this, but they have to be carefully decided on a
179
+
case-by-case basis.
180
+
181
+
### Implementation and Feedback Cycle
182
+
183
+
Once we've accepted a design, we can move forward with implementation and
184
+
creating pull requests.
185
+
186
+
The implementation should generally be unsurprising, since we should have
187
+
already worked out most of the kinks during the earlier design discussions. If
188
+
there are significant new issues or concerns uncovered during implementation,
189
+
then these should be brought up in the design proposal discussion thread again,
190
+
and the evolved design reaffirmed with two team members signing off once
191
+
again.
192
+
193
+
If there are no new concerns uncovered, then the implementation just needs to be
194
+
checked over by at least one team member. They provide code review and feedback
195
+
on the implementation, then the feedback is addressed and pull request updated.
196
+
Once the pull request is in a good place and CI is passing, a team member may
197
+
approve the pull request and merge it into Gloo. If any team member raises
198
+
concerns with the implementation, they must be resolved before the pull request
199
+
is merged.
200
+
201
+
#### Implementation Checklist
202
+
203
+
Here is a checklist that all crate and API implementations in Gloo should
204
+
fulfill:
205
+
206
+
*[ ] The crate should be named `gloo-foobar`, located at `gloo/crates/foobar`,
207
+
and re-exported from the umbrella Gloo crate like:
208
+
209
+
```rust
210
+
// gloo/src/lib.rs
211
+
212
+
pub use gloo_foobar as foobar;
213
+
```
214
+
215
+
*[ ] The `authors` entry in `gloo/crates/foobar/Cargo.toml` is "The Rust and
216
+
WebAssembly Working Group".
217
+
218
+
*[ ] Uses [`unwrap_throw` and `expect_throw`][unwrap-throw] instead of normal
219
+
`unwrap` and `expect`.
137
220
138
221
*[ ] Headless browser and/or Node.js tests via `wasm-pack test`.
0 commit comments