Skip to main content

FileEditor

Trait FileEditor 

Source
pub trait FileEditor {
    // Required methods
    fn apply_textdelta(
        &mut self,
        base_checksum: Option<&str>,
    ) -> Result<Box<dyn for<'a> Fn(&'a mut TxDeltaWindow) -> Result<(), Error<'static>>>, Error<'static>>;
    fn change_prop(
        &mut self,
        name: &str,
        value: Option<&[u8]>,
    ) -> Result<(), Error<'static>>;
    fn close(
        &mut self,
        text_checksum: Option<&str>,
    ) -> Result<(), Error<'static>>;

    // Provided method
    fn apply_textdelta_stream(
        &mut self,
        _base_checksum: Option<&str>,
        _open_stream: Box<dyn FnOnce() -> Result<TxDeltaStream, Error<'static>>>,
    ) -> Result<(), Error<'static>> { ... }
}
Expand description

Trait for file editor operations.

Required Methods§

Source

fn apply_textdelta( &mut self, base_checksum: Option<&str>, ) -> Result<Box<dyn for<'a> Fn(&'a mut TxDeltaWindow) -> Result<(), Error<'static>>>, Error<'static>>

Applies a text delta to the file.

Source

fn change_prop( &mut self, name: &str, value: Option<&[u8]>, ) -> Result<(), Error<'static>>

Changes a property on the file. Pass None for value to delete the property.

Source

fn close(&mut self, text_checksum: Option<&str>) -> Result<(), Error<'static>>

Closes the file editor.

Provided Methods§

Source

fn apply_textdelta_stream( &mut self, _base_checksum: Option<&str>, _open_stream: Box<dyn FnOnce() -> Result<TxDeltaStream, Error<'static>>>, ) -> Result<(), Error<'static>>

Applies a text delta stream to the file.

The open_stream callback should create and return a TxDeltaStream that provides the delta data. This is an alternative to apply_textdelta that can be more efficient for streaming operations.

Default implementation returns an error indicating it’s not supported.

Implementors§

Source§

impl<'pool> FileEditor for WrapFileEditor<'pool>