1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
use TokenStream;
/// Declares a blueprint.
///
/// The `blueprint` macro is a convenient way to define a new blueprint. It takes
/// two arguments:
/// - A `struct` which defines the structure
/// - A `impl` which defines the implementation.
///
/// This macro will derive the dispatcher method responsible for handling invocation
/// according to Scrypto ABI.
///
/// # Example
/// ```ignore
/// use scrypto::prelude::*;
///
/// #[blueprint]
/// mod counter {
/// struct Counter {
/// count: u32
/// }
///
/// impl Counter {
/// pub fn new() -> Component {
/// Self {
/// count: 0
/// }.instantiate()
/// }
///
/// pub fn get_and_incr(&mut self) -> u32 {
/// let n = self.count;
/// self.count += 1;
/// n
/// }
/// }
/// }
/// ```
/// Derive code that describe a non-fungible data structure.
///
/// # Example
///
/// ```ignore
/// use scrypto::prelude::*;
///
/// #[derive(NonFungibleData)]
/// pub struct MyStruct {
/// pub field_1: u32,
/// #[mutable]
/// pub field_2: String,
/// }
/// ```