pub struct Workspace { /* private fields */ }
Implementations§
Source§impl Workspace
impl Workspace
pub fn new(path: impl AsRef<Path>) -> Workspace
Sourcepub fn resolve_path(&self, path: &Path) -> PathBuf
pub fn resolve_path(&self, path: &Path) -> PathBuf
Resolves a path relative to this workspace.
‘/’ is treated as the workspace root.
§Panic
- Will panic if
..
present at root. - Will also panic if prefix is present (only on windows)
pub fn is_protected(&self, path: &Path) -> bool
pub fn create_file(&self, path: &Path) -> Result<RegularFile, WorkspaceError>
pub fn as_dir(&self) -> Dir<'_>
pub fn join<P>(&self, path: P) -> PathBuf
Trait Implementations§
Source§impl WorkspaceDirectory for Workspace
impl WorkspaceDirectory for Workspace
Source§fn my_workspace(&self) -> &Workspace
fn my_workspace(&self) -> &Workspace
Gets the workspace this directory is part of.
Source§fn file(&self, file: &str) -> Result<RegularFile, WorkspaceError>
fn file(&self, file: &str) -> Result<RegularFile, WorkspaceError>
Creates a file within this directory Read more
Source§fn dir(&self, name: &str) -> Result<Dir<'_>, WorkspaceError>
fn dir(&self, name: &str) -> Result<Dir<'_>, WorkspaceError>
Creates a directory within this directory Read more
Source§fn protected_dir(&self, name: &str) -> Result<Dir<'_>, WorkspaceError>
fn protected_dir(&self, name: &str) -> Result<Dir<'_>, WorkspaceError>
Creates a protected directory in this directory Read more
Source§fn protected_file(&self, name: &str) -> Result<RegularFile, WorkspaceError>
fn protected_file(&self, name: &str) -> Result<RegularFile, WorkspaceError>
Creates a protected file in this directory Read more
Source§fn 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. Read more
Source§fn absolute_path(&self) -> PathBuf
fn absolute_path(&self) -> PathBuf
Gets the absolute path of this directory
Source§impl WorkspaceEntry for Workspace
impl WorkspaceEntry for Workspace
fn into_absolute_path(self) -> Result<PathBuf, WorkspaceError>
Auto Trait Implementations§
impl Freeze for Workspace
impl RefUnwindSafe for Workspace
impl Send for Workspace
impl Sync for Workspace
impl Unpin for Workspace
impl UnwindSafe for Workspace
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> InstanceOf for T
impl<T> InstanceOf for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more