pub mod func;
pub use func::*;
pub mod field;
pub use field::*;
pub mod prototype;
pub use prototype::*;
use serde::{Deserialize, Serialize};
use crate::model::{Graph, NodeRef, StofData};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct InnerDoc {
pub docs: String,
}
#[typetag::serde(name = "InnerDoc")]
impl StofData for InnerDoc {
fn core_data(&self) -> bool {
return true;
}
}
impl InnerDoc {
pub fn docs(graph: &Graph, node: &NodeRef) -> String {
let mut docs = Vec::new();
if let Some(node) = node.node(graph) {
for (_, dref) in &node.data {
if let Some(doc) = graph.get_stof_data::<Self>(dref) {
docs.push(doc.docs.clone());
}
}
}
docs.join("\n\n")
}
}