File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -311,7 +311,7 @@ pub fn get_capability(issuer: &Address, params: &str) -> Option<Capability> {
311311/// The `Spawn!()` macro is defined here as a no-op.
312312/// However, in practice, `kit build` will rewrite it during pre-processing.
313313///
314- /// Example :
314+ /// Examples :
315315/// ```no_run
316316/// fn init(our: Address) {
317317/// let parent = our.clone();
@@ -328,8 +328,20 @@ pub fn get_capability(issuer: &Address, params: &str) -> Option<Capability> {
328328/// the generated child and send a [`Request()`] to pass in the closure's args.
329329/// 3. Update the relevant metadata for the package
330330/// (i.e. `Cargo.toml`, `metadata.json`, etc.).
331+ ///
332+ ///
333+ /// ```no_run
334+ /// fn init(our: Address) {
335+ /// let parent = our.clone();
336+ /// Spawn!(my_function(parent));
337+ /// ...
338+ /// }
339+ /// ```
331340#[ macro_export]
332341macro_rules! Spawn {
333- // Match one or more type-annotated parameters
342+ // Pattern 1: Match closure with type-annotated parameters
334343 ( |$( $param: ident : $type: ty) ,+ $( , ) ?| $body: block) => { } ;
344+
345+ // Pattern 2: Match function call
346+ ( $fn_name: ident( $( $arg: expr) ,* $( , ) ?) ) => { } ;
335347}
You can’t perform that action at this time.
0 commit comments