Struct collective::rundir::RunDir
source · pub struct RunDir { /* private fields */ }
Implementations§
source§impl RunDir
impl RunDir
pub fn new<T: Into<PathBuf>>(path: T) -> RunDir
sourcepub fn allow_cleaning(self, allow_cleaning: bool) -> RunDir
pub fn allow_cleaning(self, allow_cleaning: bool) -> RunDir
Set whether the directory can perform cleanup operations.
Use with caution. This will clear existing directories on initialization and cleanup.
sourcepub fn initialize(&self) -> Result<(), RunDirError>
pub fn initialize(&self) -> Result<(), RunDirError>
Creates the initial RunDir.
Examples
use collective::rundir::RunDir;
let rundir = RunDir::new("tests/rundir").allow_cleaning(true);
rundir.initialize().unwrap();
rundir.cleanup().unwrap();
pub fn cleanup(&self) -> Result<(), RunDirError>
sourcepub fn create_subdir(&self, name: &str) -> Result<PathBuf, RunDirError>
pub fn create_subdir(&self, name: &str) -> Result<PathBuf, RunDirError>
Creates a subdir within the RunDir.
sourcepub fn remove_subdir_all(&self, name: &str) -> Result<(), RunDirError>
pub fn remove_subdir_all(&self, name: &str) -> Result<(), RunDirError>
Removes a subdir and all its contents from the RunDir.
sourcepub fn subdir_exists(&self, name: &str) -> Result<bool, RunDirError>
pub fn subdir_exists(&self, name: &str) -> Result<bool, RunDirError>
Checks if a subdir exists within the RunDir.