pub struct Workspace { /* private fields */ }Implementations§
Source§impl Workspace
impl Workspace
pub fn new(path: impl AsRef<Path>) -> Self
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: AsRef<Path>>(&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) -> WorkspaceResult<RegularFile>
fn file(&self, file: &str) -> WorkspaceResult<RegularFile>
Creates a file within this directory Read more
Source§fn dir(&self, name: &str) -> WorkspaceResult<Dir<'_>>
fn dir(&self, name: &str) -> WorkspaceResult<Dir<'_>>
Creates a directory within this directory Read more
Source§fn protected_dir(&self, name: &str) -> WorkspaceResult<Dir<'_>>
fn protected_dir(&self, name: &str) -> WorkspaceResult<Dir<'_>>
Creates a protected directory in this directory Read more
Source§fn protected_file(&self, name: &str) -> WorkspaceResult<RegularFile>
fn protected_file(&self, name: &str) -> WorkspaceResult<RegularFile>
Creates a protected file in this directory Read more
Source§fn new_workspace<P: AsRef<Path>>(&self, path: P) -> Workspace
fn new_workspace<P: AsRef<Path>>(&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) -> WorkspaceResult<PathBuf>
Auto Trait Implementations§
impl Freeze for Workspace
impl RefUnwindSafe for Workspace
impl Send for Workspace
impl Sync for Workspace
impl Unpin for Workspace
impl UnsafeUnpin 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