pub trait FsModuleFormat:
Debug
+ Send
+ Sync {
// Required methods
fn paths_for_name(&self, parent_dir: &Path, mod_name: &str) -> Vec<PathBuf>;
fn try_path(
&self,
path: &Path,
mod_name: Option<&str>,
) -> Option<(Box<dyn ModuleLoader>, ModuleDescriptor)>;
}Expand description
Implemented on a type to test if a given file-system path points to a MeTTa module, and to construct possible paths within a parent directory for a module of a certain name
Objects implementing this trait work with in conjunction with DirCatalog and PkgInfo to facilitate
loading modules from include directories, specific paths, and remote git repositories.
Required Methods§
Sourcefn paths_for_name(&self, parent_dir: &Path, mod_name: &str) -> Vec<PathBuf>
fn paths_for_name(&self, parent_dir: &Path, mod_name: &str) -> Vec<PathBuf>
Returns the possible paths inside a parent directory which may point to a module
NOTE: This function is allowed to return paths that may not be valid. Paths returned from this method will be passed to Self::try_path to validate them.
Sourcefn try_path(
&self,
path: &Path,
mod_name: Option<&str>,
) -> Option<(Box<dyn ModuleLoader>, ModuleDescriptor)>
fn try_path( &self, path: &Path, mod_name: Option<&str>, ) -> Option<(Box<dyn ModuleLoader>, ModuleDescriptor)>
Checks a specific path, and returns a ModuleLoader and a ModuleDescriptor if a supported module resides at the path
This method should return None if the path does not point to a valid module in the
implemented format.