use crate::prelude::*;
#[derive(CandidType, Clone, Debug, Serialize)]
pub struct Def {
module_path: &'static str,
ident: &'static str,
comments: Option<&'static str>,
}
impl Def {
#[must_use]
pub const fn new(
module_path: &'static str,
ident: &'static str,
comments: Option<&'static str>,
) -> Self {
Self {
module_path,
ident,
comments,
}
}
#[must_use]
pub const fn module_path(&self) -> &'static str {
self.module_path
}
#[must_use]
pub const fn ident(&self) -> &'static str {
self.ident
}
#[must_use]
pub const fn comments(&self) -> Option<&'static str> {
self.comments
}
#[must_use]
pub fn path(&self) -> String {
format!("{}::{}", self.module_path(), self.ident())
}
}
impl ValidateNode for Def {}
impl VisitableNode for Def {}