pub struct FormatObserver { /* private fields */ }Expand description
The crate::tools::WriteObserver [capabilities.formatters]
installs. before_write is a true no-op (format-on-write only ever
acts AFTER a mutation). after_write runs the configured formatter (if
any matches path’s extension), rewrites the file when the formatter’s
output differs from what was just written, and — when
Self::diff_back is true — returns a unified diff annotation so
the calling tool’s result stays truthful about the file’s final bytes
(C10).
Implementations§
Trait Implementations§
Source§impl Debug for FormatObserver
impl Debug for FormatObserver
Source§impl WriteObserver for FormatObserver
impl WriteObserver for FormatObserver
Source§fn before_write<'life0, 'life1, 'async_trait>(
&'life0 self,
_path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn before_write<'life0, 'life1, 'async_trait>(
&'life0 self,
_path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
path (already resolved + sandbox-checked) is about to be
created/overwritten/deleted. Implementations must be fast and must
never propagate a failure as a tool error — a capture failure should
degrade the OBSERVER (e.g. disable itself with a one-time warning),
never block or fail the user’s actual edit.Source§fn after_write<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn after_write<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
path was just written/deleted successfully. Not called when the
tool call itself failed (e.g. the write errored before completing).
Returns an optional annotation for the calling tool’s result text —
see the trait doc comment above.Auto Trait Implementations§
impl Freeze for FormatObserver
impl RefUnwindSafe for FormatObserver
impl Send for FormatObserver
impl Sync for FormatObserver
impl Unpin for FormatObserver
impl UnsafeUnpin for FormatObserver
impl UnwindSafe for FormatObserver
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