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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
pub mod array;
pub mod inline_table;
pub mod item_value;
pub mod key_value;
pub mod right_value;

use crate::model::layer210::{DoubleQuotedString, LiteralString, SingleQuotedString};

/// It has multiple item values.  

/// 複数の項目値を持ちます。  

#[derive(Clone)]
pub struct Array {
    items: Vec<ItemValue>,
}

/// It has multiple key-values.  

/// 複数の キー・バリュー を持ちます。  

#[derive(Clone)]
pub struct InlineTable {
    items: Vec<KeyValue>,
}

/// Array, inline table item.  

/// 配列、インライン・テーブルの項目です。  

#[derive(Clone)]
pub enum ItemValue {
    /// Recursive.

    /// 再帰的。

    Array(Array),
    DoubleQuotedString(DoubleQuotedString),
    /// Recursive.

    /// 再帰的。

    InlineTable(InlineTable),
    /// Recursive.

    /// 再帰的。

    KeyValue(KeyValue),
    LiteralString(LiteralString),
    SingleQuotedString(SingleQuotedString),
}

/// It has a key and a value.  

/// キーと値を持ちます。  

#[derive(Clone)]
pub struct KeyValue {
    pub key: String,
    /// Recursive.

    /// 再帰的。

    pub value: Box<RightValue>,
}

/// The right side of the key value model.  

/// キー値モデルの右辺です。  

#[derive(Clone)]
pub enum RightValue {
    /// Recursive.

    /// 再帰的。

    Array(Array),
    DoubleQuotedString(DoubleQuotedString),
    /// Recursive.

    /// 再帰的。

    InlineTable(InlineTable),
    // No KeyValue.

    LiteralString(LiteralString),
    SingleQuotedString(SingleQuotedString),
}