feat: can create root
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2024-05-10 22:47:32 +02:00
parent c54fc3f4d0
commit 442ab64583
5 changed files with 36 additions and 1 deletions

View File

@@ -196,6 +196,15 @@ impl Engine {
Ok(())
}
pub fn get_roots(&self) -> Option<Vec<String>> {
let items = self.graph.keys().cloned().collect::<Vec<_>>();
if items.is_empty() {
None
} else {
Some(items)
}
}
}
impl Display for Engine {

View File

@@ -9,6 +9,10 @@ impl Querier {
Self { engine }
}
pub fn get_available_roots(&self) -> Option<Vec<String>> {
self.engine.get_roots()
}
pub fn get(
&self,
root: &str,

View File

@@ -63,4 +63,8 @@ impl SharedEngine {
Ok(())
}
pub(crate) fn get_roots(&self) -> Option<Vec<String>> {
self.inner.read().unwrap().get_roots()
}
}