pub trait WorkspaceDirectory: WorkspaceEntry {
// Required methods
fn my_workspace(&self) -> &Workspace;
fn rel_path(&self) -> PathBuf;
fn file(&self, file: &str) -> Result<RegularFile, WorkspaceError>;
fn dir(&self, name: &str) -> Result<Dir<'_>, WorkspaceError>;
fn protected_dir(&self, name: &str) -> Result<Dir<'_>, WorkspaceError>;
fn protected_file(&self, name: &str) -> Result<RegularFile, WorkspaceError>;
// Provided methods
fn new_workspace<P>(&self, path: P) -> Workspace
where P: AsRef<Path> { ... }
fn absolute_path(&self) -> PathBuf { ... }
fn is_protected(&self, path: &Path) -> bool { ... }
}
Required Methods§
Sourcefn my_workspace(&self) -> &Workspace
fn my_workspace(&self) -> &Workspace
Gets the workspace this directory is part of.
Sourcefn file(&self, file: &str) -> Result<RegularFile, WorkspaceError>
fn file(&self, file: &str) -> Result<RegularFile, WorkspaceError>
Sourcefn dir(&self, name: &str) -> Result<Dir<'_>, WorkspaceError>
fn dir(&self, name: &str) -> Result<Dir<'_>, WorkspaceError>
Creates a directory within this directory
§Error
Will panic if ..
paths are present at root of workspace
Sourcefn protected_dir(&self, name: &str) -> Result<Dir<'_>, WorkspaceError>
fn protected_dir(&self, name: &str) -> Result<Dir<'_>, WorkspaceError>
Creates a protected directory in this directory
§Error
Will panic if ..
paths are present at root of workspace
Sourcefn protected_file(&self, name: &str) -> Result<RegularFile, WorkspaceError>
fn protected_file(&self, name: &str) -> Result<RegularFile, WorkspaceError>
Creates a protected file in this directory
§Error
Will panic if ..
paths are present at root of workspace
Provided Methods§
Sourcefn new_workspace<P>(&self, path: P) -> Workspace
fn new_workspace<P>(&self, path: P) -> Workspace
Create a workspace that’s relative to this workspace. Shares proteced paths with parent workspace and other created workspaces.
§Error
Will panic if any ..
paths are present.
Sourcefn absolute_path(&self) -> PathBuf
fn absolute_path(&self) -> PathBuf
Gets the absolute path of this directory
Sourcefn is_protected(&self, path: &Path) -> bool
fn is_protected(&self, path: &Path) -> bool
Checks if a path is protected.
The path should be a relative path from the member.
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.