Skip to content

Commit a690b4d

Browse files
committed
change Spawn!() to require arg types
1 parent 36d7220 commit a690b4d

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/lib.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,8 @@ pub fn get_capability(issuer: &Address, params: &str) -> Option<Capability> {
314314
/// Example:
315315
/// ```no_run
316316
/// fn init(our: Address) {
317-
/// Spawn!(|our| {
317+
/// let parent = our.clone();
318+
/// Spawn!(|parent: Address| {
318319
/// println!("hello from {our}. I am Spawn of {}!", args["our"]);
319320
/// });
320321
/// ...
@@ -329,9 +330,6 @@ pub fn get_capability(issuer: &Address, params: &str) -> Option<Capability> {
329330
/// (i.e. `Cargo.toml`, `metadata.json`, etc.).
330331
#[macro_export]
331332
macro_rules! Spawn {
332-
// Matches a closure with one parameter
333-
(|$param:ident| $body:block) => {};
334-
335-
// If you also need to support multiple parameters in the closure:
336-
(|$($param:ident),*| $body:block) => {};
333+
// Match one or more type-annotated parameters
334+
(|$($param:ident : $type:ty),+ $(,)?| $body:block) => {};
337335
}

0 commit comments

Comments
 (0)