1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
//! Key value model.  

//! キー値モデル。  


use crate::model::{
    layer110::token::Token,
    layer220::{KeyValue, RightValue},
};
use std::fmt;

impl KeyValue {
    pub fn new(token: &Token, value: &RightValue) -> Self {
        KeyValue {
            key: token.value.to_string(),
            value: Box::new(value.clone()),
        }
    }
}
impl fmt::Debug for KeyValue {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}={:?}", self.key, self.value)
    }
}