Skip to main content

EditOperations

Trait EditOperations 

Source
pub trait EditOperations: Send + Sync {
    // Required methods
    fn read_file<'life0, 'life1, 'async_trait>(
        &'life0 self,
        absolute_path: &'life1 Path,
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn write_file<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        absolute_path: &'life1 Path,
        content: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn access<'life0, 'life1, 'async_trait>(
        &'life0 self,
        absolute_path: &'life1 Path,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Pluggable operations for the edit tool (matching pi’s EditOperations). Override these to delegate file editing to remote systems (for example SSH).

Required Methods§

Source

fn read_file<'life0, 'life1, 'async_trait>( &'life0 self, absolute_path: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read file contents as a String.

Source

fn write_file<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, absolute_path: &'life1 Path, content: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Write content to a file.

Source

fn access<'life0, 'life1, 'async_trait>( &'life0 self, absolute_path: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if file is readable and writable (throw if not).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§