summaryrefslogtreecommitdiffstats
path: root/src/annotate.rs
blob: 9e1e83197de02e41bf06c4dc0a8ddd497bbe52b7 (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
use serde::Serialize;
use syn::visit::Visit;
use syn::FnDecl;

#[derive(Serialize)]
#[serde(tag = "type")]
pub enum Annotation {
    #[serde(rename = "link")]
    Link {
        lineno: u32,
        colno: u32,
        len: u32,
        to: String,
        #[serde(skip_serializing_if = "Option::is_none")]
        title: Option<String>,
        #[serde(skip_serializing_if = "Option::is_none")]
        color: Option<String>,
    },
    #[serde(rename = "markdown")]
    Markdown {
        lineno: u32,
        title: String,
        content: String,
    },
}

pub struct FnVisitor;

impl<'ast> Visit<'ast> for FnVisitor {
    fn visit_fn_decl(&mut self, i: &'ast FnDecl) {
        dbg!(i);
    }
}