tiedcrossing_type/tree/
entry.rs

1// SPDX-FileCopyrightText: 2022 Profian Inc. <opensource@profian.com>
2// SPDX-License-Identifier: AGPL-3.0-only
3
4use super::super::Meta;
5
6use std::collections::HashMap;
7
8use serde::{Deserialize, Serialize};
9use serde_json::Value;
10
11/// A directory entry
12///
13/// Note that this type is designed to be extensible. Therefore, the fields
14/// here represent the minimum required fields. Other fields may be present.
15#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
16pub struct Entry<C: ?Sized = ()> {
17    /// The metadata of this entry
18    #[serde(flatten)]
19    pub meta: Meta,
20
21    /// Custom fields
22    #[serde(flatten)]
23    pub custom: HashMap<String, Value>,
24
25    #[serde(skip)]
26    pub content: C,
27}
28
29impl<C> Entry<C> {
30    pub const TYPE: &'static str = "application/vnd.drawbridge.entry.v1+json";
31}