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
use crate::candid::utils::{ArgumentDecoder, ArgumentEncoder};
use crate::{CallResponse, Context, Principal};
pub mod management;
pub trait Method {
const NAME: &'static str;
type Arguments: ArgumentEncoder;
type Response: for<'de> ArgumentDecoder<'de>;
#[inline]
fn perform<T: Context>(
ctx: &'static T,
id: Principal,
args: Self::Arguments,
) -> CallResponse<Self::Response> {
ctx.call(id, Self::NAME, args)
}
#[inline]
fn perform_with_payment<T: Context>(
ctx: &'static T,
id: Principal,
args: Self::Arguments,
cycles: u64,
) -> CallResponse<Self::Response> {
ctx.call_with_payment(id, Self::NAME, args, cycles)
}
}