pub struct Workspace { /* private fields */ }Expand description
The folder the actions are confined to.
Implementations§
Source§impl Workspace
impl Workspace
Sourcepub fn new(root: &Path) -> Result<Self>
pub fn new(root: &Path) -> Result<Self>
The folder the actions are confined to; it is canonicalized, so links are resolved once.
§Errors
When the folder does not exist, cannot be resolved or is not a folder.
Sourcepub fn preview(&self, action: &Action) -> Result<Preview, String>
pub fn preview(&self, action: &Action) -> Result<Preview, String>
What an action would do, for the approval card. Nothing changes on disk.
§Errors
When the action cannot be done as asked (a path outside the workspace, an edit whose text
does not match exactly once); the sentence is the one Self::perform would give.
Sourcepub fn perform(&self, action: &Action, cancelled: &dyn Fn() -> bool) -> Outcome
pub fn perform(&self, action: &Action, cancelled: &dyn Fn() -> bool) -> Outcome
Does the action. It never panics: every failure becomes an Outcome with
is_error set and a sentence the model can act on. cancelled is asked about every
50 ms while a command runs; when it answers true the command is stopped.
Trait Implementations§
impl Eq for Workspace
impl StructuralPartialEq for Workspace
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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