#[blueprint]
Expand description
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
ⓘ
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
}
}
}