1use crate::prelude::*;
2
3#[derive(CandidType, Clone, Debug, Serialize)]
8pub struct Def {
9 module_path: &'static str,
10 ident: &'static str,
11 comments: Option<&'static str>,
12}
13
14impl Def {
15 #[must_use]
17 pub const fn new(
18 module_path: &'static str,
19 ident: &'static str,
20 comments: Option<&'static str>,
21 ) -> Self {
22 Self {
23 module_path,
24 ident,
25 comments,
26 }
27 }
28
29 #[must_use]
31 pub const fn module_path(&self) -> &'static str {
32 self.module_path
33 }
34
35 #[must_use]
37 pub const fn ident(&self) -> &'static str {
38 self.ident
39 }
40
41 #[must_use]
43 pub const fn comments(&self) -> Option<&'static str> {
44 self.comments
45 }
46
47 #[must_use]
51 pub fn path(&self) -> String {
52 format!("{}::{}", self.module_path(), self.ident())
53 }
54}
55
56impl ValidateNode for Def {}
57
58impl VisitableNode for Def {}