summaryrefslogtreecommitdiffstats
path: root/src/types.rs
diff options
context:
space:
mode:
authorMinijackson <minijackson@riseup.net>2020-01-18 18:06:34 +0100
committerMinijackson <minijackson@riseup.net>2020-01-18 18:06:34 +0100
commitbcf3344bf2e69b306c0ee867ea8b67edab20c1a7 (patch)
treef4425b1ad894969d13cbf501c0979bdee140247f /src/types.rs
parente000a80e1755b6a5f6c11720274d714b0f1a3b75 (diff)
downloadposeidoc-bcf3344bf2e69b306c0ee867ea8b67edab20c1a7.tar.gz
poseidoc-bcf3344bf2e69b306c0ee867ea8b67edab20c1a7.zip
add properties to entities, cleaner clang data transformation
Diffstat (limited to 'src/types.rs')
-rw-r--r--src/types.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/types.rs b/src/types.rs
index 1cd1b57..4099714 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -1,4 +1,5 @@
1use serde_derive::{Deserialize, Serialize}; 1use serde_derive::{Deserialize, Serialize};
2use serde_json::{Map, Value};
2use thiserror::Error; 3use thiserror::Error;
3 4
4use std::collections::BTreeMap; 5use std::collections::BTreeMap;
@@ -8,13 +9,15 @@ use std::str::FromStr;
8// Maybe use the builder pattern? 9// Maybe use the builder pattern?
9 10
10#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] 11#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12#[serde(rename_all = "kebab-case")]
11#[non_exhaustive] 13#[non_exhaustive]
12pub struct Poseidoc { 14pub struct Poseidoc {
13 pub config: toml::Value, 15 pub config: toml::Value,
14 pub entities: BTreeMap<String, Entity>, 16 pub entities: BTreeMap<String, Entity>,
15} 17}
16 18
17#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] 19#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
20#[serde(rename_all = "kebab-case")]
18#[non_exhaustive] 21#[non_exhaustive]
19pub struct Entity { 22pub struct Entity {
20 pub name: String, 23 pub name: String,
@@ -23,6 +26,7 @@ pub struct Entity {
23 pub kind: EntityKind, 26 pub kind: EntityKind,
24 pub brief_description: String, 27 pub brief_description: String,
25 pub documentation: String, 28 pub documentation: String,
29 pub properties: Map<String, Value>,
26 pub children: Children, 30 pub children: Children,
27} 31}
28 32
@@ -79,7 +83,6 @@ pub struct LanguageParseError(());
79#[serde(transparent)] 83#[serde(transparent)]
80pub struct EntityKind(pub String); 84pub struct EntityKind(pub String);
81 85
82
83/// Plural version of EntityKind 86/// Plural version of EntityKind
84#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] 87#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
85#[serde(transparent)] 88#[serde(transparent)]