iota_types/
collection_types.rs1use iota_sdk_types::ObjectId;
6use serde::{Deserialize, Serialize};
7
8use crate::id::UID;
9
10#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]
12pub struct VecMap<K, V> {
13 pub contents: Vec<Entry<K, V>>,
14}
15
16#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]
18pub struct Entry<K, V> {
19 pub key: K,
20 pub value: V,
21}
22
23#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]
25pub struct VecSet<T> {
26 pub contents: Vec<T>,
27}
28
29#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]
31pub struct TableVec {
32 pub contents: Table,
33}
34
35impl Default for TableVec {
36 fn default() -> Self {
37 TableVec {
38 contents: Table {
39 id: ObjectId::ZERO,
40 size: 0,
41 },
42 }
43 }
44}
45
46#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]
48pub struct Table {
49 pub id: ObjectId,
50 pub size: u64,
51}
52
53impl Default for Table {
54 fn default() -> Self {
55 Table {
56 id: ObjectId::ZERO,
57 size: 0,
58 }
59 }
60}
61
62#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]
64pub struct Bag {
65 pub id: UID,
66 pub size: u64,
67}
68
69impl Default for Bag {
70 fn default() -> Self {
71 Self {
72 id: UID::new(ObjectId::ZERO),
73 size: 0,
74 }
75 }
76}