workspacer_workspace_interface/
workspace_interface.rs

1// ---------------- [ File: workspacer-workspace-interface/src/workspace_interface.rs ]
2crate::ix!();
3
4pub trait WorkspaceInterface<P,T>
5: GetCrates<P,T>
6+ GetCratesMut<P,T>
7+ Send
8+ Sync
9+ NumCrates
10+ ValidateIntegrity
11+ AsyncTryFrom<P>
12+ AsyncPathValidator
13+ AsyncFindItems
14+ AsRef<Path>
15+ GetAllCrateNames
16+ FindCrateByName<P,T>
17where 
18for<'async_trait> P: From<PathBuf> + AsRef<Path> + Send + Sync + 'async_trait,
19T: CrateHandleInterface<P>
20{}
21
22pub trait GetCrates<P,T> 
23where 
24    for<'async_trait> P: From<PathBuf> + AsRef<Path> + Send + Sync + 'async_trait,
25    T: CrateHandleInterface<P> 
26{
27    fn crates(&self) -> &[Arc<AsyncMutex<T>>];
28}
29
30pub trait GetCratesMut<P,T> 
31where 
32    for<'async_trait> P: From<PathBuf> + AsRef<Path> + Send + Sync + 'async_trait,
33    T: CrateHandleInterface<P> 
34{
35    fn crates_mut(&mut self) -> &mut Vec<Arc<AsyncMutex<T>>>;
36}
37
38pub trait NumCrates {
39    fn n_crates(&self) -> usize;
40}
41
42#[async_trait]
43pub trait FindCrateByName<P,T> 
44where 
45    for<'async_trait> P: From<PathBuf> + AsRef<Path> + Send + Sync + 'async_trait,
46    T: CrateHandleInterface<P> 
47{
48    async fn find_crate_by_name(&self, name: &str) -> Option<Arc<AsyncMutex<T>>>;
49}
50
51#[async_trait]
52pub trait GetAllCrateNames {
53    async fn get_all_crate_names(&self) -> Vec<String>;
54}