-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathparts.rs
43 lines (35 loc) · 1.31 KB
/
parts.rs
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
use sails_rs::prelude::*;
pub type CollectionId = ActorId;
pub type ZIndex = u32;
pub type PartId = u32;
#[derive(Decode, Encode, TypeInfo, Clone)]
#[codec(crate = sails_rs::scale_codec)]
#[scale_info(crate = sails_rs::scale_info)]
pub enum Part {
Fixed(FixedPart),
Slot(SlotPart),
}
#[derive(Decode, Encode, TypeInfo, Clone)]
#[codec(crate = sails_rs::scale_codec)]
#[scale_info(crate = sails_rs::scale_info)]
pub struct FixedPart {
/// An optional zIndex of base part layer.
/// specifies the stack order of an element.
/// An element with greater stack order is always in front of an element with a lower stack order.
pub z: Option<ZIndex>,
/// The metadata URI of the part.
pub metadata_uri: String,
}
#[derive(Decode, Encode, TypeInfo, Clone)]
#[codec(crate = sails_rs::scale_codec)]
#[scale_info(crate = sails_rs::scale_info)]
pub struct SlotPart {
/// Array of whitelisted collections that can be equipped in the given slot. Used with slot parts only.
pub equippable: Vec<CollectionId>,
/// An optional zIndex of base part layer.
/// specifies the stack order of an element.
/// An element with greater stack order is always in front of an element with a lower stack order.
pub z: Option<ZIndex>,
/// The metadata URI of the part.
pub metadata_uri: String,
}