cbindgen/bindgen/ir/
documentation.rs1use crate::bindgen::utilities::SynAttributeHelpers;
6
7#[derive(Debug, Clone)]
8pub struct Documentation {
9 pub doc_comment: Vec<String>,
10}
11
12impl Documentation {
13 pub fn load(attrs: &[syn::Attribute]) -> Self {
14 let doc = attrs
15 .get_comment_lines()
16 .into_iter()
17 .filter(|x| !x.trim_start().starts_with("cbindgen:"))
18 .collect();
19
20 Documentation { doc_comment: doc }
21 }
22
23 pub fn simple(line: &str) -> Self {
24 Documentation {
25 doc_comment: vec![line.to_owned()],
26 }
27 }
28
29 pub fn none() -> Self {
30 Documentation {
31 doc_comment: Vec::new(),
32 }
33 }
34}