1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
extern crate serde;
extern crate serde_json;

use super::types::FontEntry;
use serde::{Deserialize, Serialize};
use serde_json::json;

#[derive(Serialize, Deserialize)]
pub struct Font {
  pub path: String,
  pub entries: Vec<FontEntry>,
}

impl Font {
  pub fn to_json(&self) -> String {
    let result = json!({
      &self.path: self.entries
    })
    .to_string();

    result.to_string()
  }
}