aboutsummaryrefslogtreecommitdiff
path: root/src/note.rs
blob: ef380945b99386e58325002b158f97257dd5f49d (plain)
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
//! The data model shared by all adapters and by the index.

use serde::{Deserialize, Serialize};

/// A link from one note to another.  Types are optional.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Link {
    pub dst: String,
    pub kind: Option<String>,
}

/// One note.  A file is a container of notes; the note is the unit.
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Note {
    /// `None` for a note that has no ID yet; `check` reports these.
    pub id: Option<String>,
    pub path: String,
    /// Byte span of the note inside its file.
    pub start: usize,
    pub end: usize,
    /// 1-based line number of the first line of the note.
    pub line: usize,
    /// Hash of the span, used to detect changed notes.
    pub hash: String,
    pub title: String,
    pub date: Option<String>,
    pub kind: Option<String>,
    pub tags: Vec<String>,
    pub parent: Option<String>,
    pub links: Vec<Link>,
    pub context: Option<String>,
    pub summary: Option<String>,
    /// The text to index.  It is never written to the manifest.
    #[serde(skip)]
    pub body: String,
}