@@ -162,7 +162,10 @@ impl<COMP: Component> Scope<COMP> {
162
162
scheduler ( ) . push_comp ( ComponentRunnableType :: Destroy , Box :: new ( destroy) ) ;
163
163
}
164
164
165
- /// Send a message to the component
165
+ /// Send a message to the component.
166
+ ///
167
+ /// Please be aware that currently this method synchronously
168
+ /// schedules a call to the [Component](Component) interface.
166
169
pub fn send_message < T > ( & self , msg : T )
167
170
where
168
171
T : Into < COMP :: Message > ,
@@ -172,14 +175,22 @@ impl<COMP: Component> Scope<COMP> {
172
175
173
176
/// Send a batch of messages to the component.
174
177
///
175
- /// This is useful for reducing re-renders of the components because the messages are handled
176
- /// together and the view function is called only once if needed.
178
+ /// This is useful for reducing re-renders of the components
179
+ /// because the messages are handled together and the view
180
+ /// function is called only once if needed.
181
+ ///
182
+ /// Please be aware that currently this method synchronously
183
+ /// schedules calls to the [Component](Component) interface.
177
184
pub fn send_message_batch ( & self , messages : Vec < COMP :: Message > ) {
178
185
self . update ( ComponentUpdate :: MessageBatch ( messages) , false ) ;
179
186
}
180
187
181
- /// Creates a `Callback` which will send a message to the linked component's
182
- /// update method when invoked.
188
+ /// Creates a `Callback` which will send a message to the linked
189
+ /// component's update method when invoked.
190
+ ///
191
+ /// Please be aware that currently the result of this callback
192
+ /// synchronously schedules a call to the [Component](Component)
193
+ /// interface.
183
194
pub fn callback < F , IN , M > ( & self , function : F ) -> Callback < IN >
184
195
where
185
196
M : Into < COMP :: Message > ,
@@ -193,8 +204,12 @@ impl<COMP: Component> Scope<COMP> {
193
204
closure. into ( )
194
205
}
195
206
196
- /// Creates a `Callback` from a FnOnce which will send a message to the linked
197
- /// component's update method when invoked.
207
+ /// Creates a `Callback` from a FnOnce which will send a message
208
+ /// to the linked component's update method when invoked.
209
+ ///
210
+ /// Please be aware that currently the result of this callback
211
+ /// will synchronously schedule calls to the
212
+ /// [Component](Component) interface.
198
213
pub fn callback_once < F , IN , M > ( & self , function : F ) -> Callback < IN >
199
214
where
200
215
M : Into < COMP :: Message > ,
@@ -208,8 +223,12 @@ impl<COMP: Component> Scope<COMP> {
208
223
Callback :: once ( closure)
209
224
}
210
225
211
- /// Creates a `Callback` which will send a batch of messages back to the linked
212
- /// component's update method when invoked.
226
+ /// Creates a `Callback` which will send a batch of messages back
227
+ /// to the linked component's update method when invoked.
228
+ ///
229
+ /// Please be aware that currently the results of these callbacks
230
+ /// will synchronously schedule calls to the
231
+ /// [Component](Component) interface.
213
232
pub fn batch_callback < F , IN > ( & self , function : F ) -> Callback < IN >
214
233
where
215
234
F : Fn ( IN ) -> Vec < COMP :: Message > + ' static ,
@@ -236,6 +255,8 @@ struct ComponentState<COMP: Component> {
236
255
}
237
256
238
257
impl < COMP : Component > ComponentState < COMP > {
258
+ /// Creates a new `ComponentState`, also invokes the `create()`
259
+ /// method on component to create it.
239
260
fn new (
240
261
parent : Element ,
241
262
ancestor : Option < VNode > ,
@@ -255,6 +276,9 @@ impl<COMP: Component> ComponentState<COMP> {
255
276
}
256
277
}
257
278
279
+ /// A `Runnable` task which creates the `ComponentState` (if there is
280
+ /// none) and invokes the `create()` method on a `Component` to create
281
+ /// it.
258
282
struct CreateComponent < COMP >
259
283
where
260
284
COMP : Component ,
@@ -285,6 +309,7 @@ where
285
309
}
286
310
}
287
311
312
+ /// A `Runnable` task which calls the `update()` method on a `Component`.
288
313
struct UpdateComponent < COMP >
289
314
where
290
315
COMP : Component ,
@@ -334,6 +359,7 @@ where
334
359
}
335
360
}
336
361
362
+ /// A `Runnable` task which calls the `rendered()` method on a `Component`.
337
363
struct RenderedComponent < COMP >
338
364
where
339
365
COMP : Component ,
@@ -362,6 +388,7 @@ where
362
388
}
363
389
}
364
390
391
+ /// A `Runnable` task which calls the `destroy()` method on a `Component`.
365
392
struct DestroyComponent < COMP >
366
393
where
367
394
COMP : Component ,
0 commit comments