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
use MoveDatatype;
use ;
/// Generic type signaling a one-time-witness type argument.
///
/// None of address, module and name are known at compile time, only that there are no type
/// parameters.
///
/// Use this when you want to instantiate a datatype like `Balance<phantom T>` that expects its
/// type argument to be a Move one-time-witness.
///
/// # Examples
/// ```
/// use moverox::Otw;
/// use moverox::traits::{MoveDatatype, MoveType};
/// use serde::{Deserialize, Serialize};
///
/// #[derive(MoveDatatype, Clone, Debug, Default, Deserialize, Serialize, PartialEq, Eq, Hash)]
/// #[move_(address = "0x2", module = balance)]
/// pub struct Balance<T> {
/// value: u64,
/// _otw: std::marker::PhantomData<T>,
/// }
///
/// let address = "0x2".parse().unwrap();
/// let module = "sui".parse().unwrap();
/// let name = "SUI".parse().unwrap();
/// let sui_type = Otw::type_tag(address, module, name);
/// let balance_type = Balance::<Otw>::type_tag(sui_type);
/// ```