SeedFolder

Trait SeedFolder 

Source
pub trait SeedFolder {
    // Required methods
    fn seed_name(&self) -> &str;
    fn root_dir(&self) -> impl AsRef<Path>;
    fn cell_template(&self) -> &CellDocument;

    // Provided methods
    fn seed_dir(&self) -> impl AsRef<Path> { ... }
    fn create_seed_dir(&self) -> Result<PathBuf, SeedingErrors> { ... }
    fn soft_link_potentials<P: AsRef<Path>>(
        &self,
        potential_src: P,
    ) -> Result<(), SeedingErrors> { ... }
    fn create_seed_file<P: AsRef<Path>, F: AsRef<[u8]>>(
        &self,
        filename: P,
        file_content: F,
    ) -> Result<(), SeedingErrors> { ... }
    fn write_files(
        &self,
        cell_builder: &impl CellBuilding,
        param_builder: &impl ParamBuilding,
    ) -> Result<(), SeedingErrors> { ... }
    fn actions<P: AsRef<Path>>(
        &self,
        cell_builder: &impl CellBuilding,
        param_builder: &impl ParamBuilding,
        potential_src: P,
    ) -> Result<(), SeedingErrors> { ... }
}
Expand description

A trait of how to create seed file folders. Required psuedopotential files must be copied to the root dir first.

Required Methods§

Source

fn seed_name(&self) -> &str

Source

fn root_dir(&self) -> impl AsRef<Path>

Source

fn cell_template(&self) -> &CellDocument

Provided Methods§

Source

fn seed_dir(&self) -> impl AsRef<Path>

Join seed name after the root dir as the seed directory. You might implement this by yourself to customize the seed directory naming logic.

Source

fn create_seed_dir(&self) -> Result<PathBuf, SeedingErrors>

Source

fn create_seed_file<P: AsRef<Path>, F: AsRef<[u8]>>( &self, filename: P, file_content: F, ) -> Result<(), SeedingErrors>

Source

fn write_files( &self, cell_builder: &impl CellBuilding, param_builder: &impl ParamBuilding, ) -> Result<(), SeedingErrors>

Here generates and writes all files needed. Implement by yourself to change the behavior.

Source

fn actions<P: AsRef<Path>>( &self, cell_builder: &impl CellBuilding, param_builder: &impl ParamBuilding, potential_src: P, ) -> Result<(), SeedingErrors>

One command to do all

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§