use sqlitegraph::{Label, PropertyKey};
pub fn label_function() -> Label {
Label("symbol_function".into())
}
pub fn label_class() -> Label {
Label("symbol_class".into())
}
pub fn label_enum() -> Label {
Label("symbol_enum".into())
}
pub fn label_interface() -> Label {
Label("symbol_interface".into())
}
pub fn label_impl() -> Label {
Label("symbol_impl".into())
}
pub fn label_module() -> Label {
Label("symbol_module".into())
}
pub fn label_trait() -> Label {
Label("symbol_trait".into())
}
pub fn label_variable() -> Label {
Label("symbol_variable".into())
}
pub fn label_method() -> Label {
Label("symbol_method".into())
}
pub fn label_constructor() -> Label {
Label("symbol_constructor".into())
}
pub fn label_type_alias() -> Label {
Label("symbol_type_alias".into())
}
pub fn label_file() -> Label {
Label("file".into())
}
pub fn prop_name() -> PropertyKey {
PropertyKey("name".into())
}
pub fn prop_start() -> PropertyKey {
PropertyKey("start_byte".into())
}
pub fn prop_end() -> PropertyKey {
PropertyKey("end_byte".into())
}
pub fn prop_file() -> PropertyKey {
PropertyKey("file".into())
}
pub fn prop_kind() -> PropertyKey {
PropertyKey("kind".into())
}
pub fn prop_language() -> PropertyKey {
PropertyKey("language".into())
}
pub const EDGE_CONTAINS: &str = "contains";
pub const EDGE_IMPLEMENTS: &str = "implements";
pub const EDGE_CALLS: &str = "calls";
pub const EDGE_DEFINES: &str = "defines";
pub fn kind_to_label(kind: &str) -> Label {
match kind {
"function" => label_function(),
"method" => label_method(),
"class" | "struct" => label_class(),
"interface" => label_interface(),
"enum" => label_enum(),
"impl" => label_impl(),
"trait" => label_trait(),
"module" | "namespace" => label_module(),
"variable" | "field" | "const" | "static" => label_variable(),
"constructor" => label_constructor(),
"type_alias" => label_type_alias(),
_ => label_function(), }
}