pub struct ToolCompensation {
pub description: String,
/* private fields */
}Expand description
Compensation action for external tool side effects.
ToolCompensation wraps an undo function that compensates for external tool actions (file edits, process spawns, etc.) that cannot be rolled back through normal workflow operations.
Fields§
§description: StringHuman-readable description of the compensation
Implementations§
Source§impl ToolCompensation
impl ToolCompensation
Sourcepub fn new<F>(description: impl Into<String>, compensate_fn: F) -> Self
pub fn new<F>(description: impl Into<String>, compensate_fn: F) -> Self
Creates a new ToolCompensation with the given description and undo function.
Sourcepub fn execute(&self, context: &TaskContext) -> Result<TaskResult, TaskError>
pub fn execute(&self, context: &TaskContext) -> Result<TaskResult, TaskError>
Executes the compensation action.
Sourcepub fn file_compensation(file_path: impl Into<String>) -> Self
pub fn file_compensation(file_path: impl Into<String>) -> Self
Sourcepub fn process_compensation(pid: u32) -> Self
pub fn process_compensation(pid: u32) -> Self
Trait Implementations§
Source§impl Clone for ToolCompensation
impl Clone for ToolCompensation
Source§fn clone(&self) -> ToolCompensation
fn clone(&self) -> ToolCompensation
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl From<CompensationAction> for ToolCompensation
impl From<CompensationAction> for ToolCompensation
Source§fn from(action: CompensationAction) -> Self
fn from(action: CompensationAction) -> Self
Converts to this type from the input type.
Source§impl From<ProcessGuard> for ToolCompensation
impl From<ProcessGuard> for ToolCompensation
Source§fn from(guard: ProcessGuard) -> Self
fn from(guard: ProcessGuard) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for ToolCompensation
impl !RefUnwindSafe for ToolCompensation
impl Send for ToolCompensation
impl Sync for ToolCompensation
impl Unpin for ToolCompensation
impl UnsafeUnpin for ToolCompensation
impl !UnwindSafe for ToolCompensation
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> 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